lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


There is this from 10 years ago: http://lua-users.org/lists/lua-l/2009-11/msg00491.html

It generates a graphviz plot that can be used to draw the data structures in your program. I used it once and it was fun.


On 15/5/19 18:45, Sean Conner wrote:
   Okay, I realize Lua has GC, so it's not a leak per se, but I am somehow
keeping references to data somewhere, and I can't seem to track them down.
The last time I encountered this issue, I was able to study the code and
through deductive reasoning, found the issue [1].

   But this time, not so much.  In general, how do others track down "lost"
references?  I just can't seem to locate it this time.

   In specific, the code (which I can't post sadly, because it's at work)
uses Lua 5.1 and is very simple.  It uses my network driver [2] which is
used in another project [3] which doesn't have the issue.  The major
difference between the two is that the "leaky" code uses TCP [4] in addition
to UDP.

   The program just accepts a packet via UDP (no response required---it's a
"fire-and-forget" type situation).  It then unpacks the data (which comes in
as CBOR), re-codes it as JSON, then then POSTs the data to an HTTP endpoint
elsewhere on the local network.  And *that's it!* That's what makes this so
maddening---it's so simple there's not obvious place for references to
accumulate, or at least, none that I can see, which is why I'm asking for
advice.

   -spc (Off to stare at code ... )

[1]	"Oh, if the coroutine crashes *here,* I still have a strong
	*reference to it there* ... "

[2]	https://github.com/spc476/lua-conmanorg/blob/master/lua/nfl.lua

	It's an event loop that waits for activity from a set of file
	descriptors (usually network connections) and when packets come in,
	runs a function specific to the file descriptor which can schedule a
	coroutine to run to handle any processing.

[3]	Mainly, code that processes something like 60,000,000 SIP messages
	per day, but they're all delivered via UDP.

[4]	https://github.com/spc476/lua-conmanorg/blob/master/lua/nfl/tcp.lua

	which uses

	https://github.com/spc476/lua-conmanorg/blob/master/lua/net/ios.lua

	to mimic the Lua file:read() API.