[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Debugging memory leaks
- From: Sean Conner <sean@...>
- Date: Thu, 16 May 2019 14:25:51 -0400
It was thus said that the Great Sean Conner once stated:
>
> 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.
I want to thank Jorge, Cloud Wu, and Kim Alvefur for their responses and
links to some interesting tools and techniques. I was able to finally track
down the reference I was keeping [1] and memory usage is now steady.
Thinking about this, I wonder how difficult it would be to add a debug
hook for GC---call the function just prior to reclaiming the memory. That
might help with tracking down lost references. I mean, it kind of can be
done now with the function call hook, but you get that for every call, and
it could only really work if you have a __gc() method defined [2]. Just an
idea.
-spc
[1] I wrote a tool last year (not released) that I can interactively
check a Lua state (using a text-based UI). I was able to integrate
it into the event framework, so I was able to check various tables
in real time (as the program was processing network events) to see
what table was growing without bound.
Attached is a screen shot for those that might be interested.
[2] I think---I haven't actually tested that theory yet.