in reply to Memory leak in Win32::CtrlGUI? [SOLVED, sort of]

Does this analysis sound right? What can I do prevent the ever-increasing memory footprint?

It sounds plausible, and if that is indeed the cause of the leak, you would patch http://cpansearch.perl.org/src/TEVERETT/Win32-CtrlGUI-0.30/Win32/CtrlGUI/Window.pm so it doesn't leak

But, your analysis could be wrong. Given this piece of your code

exit unless defined $coord; ... $check = $mw->after(10, \&CheckIDE)
it could easily be $check or $ide or CheckIDE leaking.

So the bug could be with your code, your version of perl, Win32::Setupsup, Win32::CtrlGUI, Tk::after, or two or more of these things together.

Replies are listed 'Best First'.
Re^2: Memory leak in Win32::CtrlGUI?
by Dr. Mu (Hermit) on Apr 12, 2011 at 16:11 UTC
    It leaks only when the line
    my $coord = $ide->get_property('rect');
    has not been commented out. The other reference to $ide is not a problem. I suspect the problem is with Win32::Setupsup, but that's just an XS shell, leading me to believe the real culprit is in the lower-level C code. (I'm not a C programmer, BTW.)

    -Phil

      has not been commented out

      That is why I said its plausible. I have vague memories of closures that would leak/stop leaking , randomly, if you added/removed lines

      I suspect the problem is with Win32::Setupsup, but that's just an XS shell, leading me to believe the real culprit is in the lower-level C code. (I'm not a C programmer, BTW.)

      I tend to agree, given this code hasn't been touched in 10+ years.

      I don't see anything obvious in

Nothing to see here.
by Dr. Mu (Hermit) on Apr 15, 2011 at 05:03 UTC
    Update 2: I gave up on Win32::CtrlGUI. I've rewritten the program to use Win32::GuiTest. Although it wasn't as straightforward to use, it works well, and the memory leak is gone.

    -Phil