in reply to Re^12: Detecting memory leaks.
in thread Detecting memory leaks.

Here is $app->Dispatch which is running the event loop manually one event at a time , this should clean up the memory but it doesn't

update: it finally does, solution is to pair $window->Destroy; Wx::wxTheApp()->ProcessIdle; don't know at what point in wxwidgets history ProcessIdle became required/necessary for memory reclamation, I don't remember needing to do that explicitly, but it seems it has, werid but a solution is a solution :)

*whew* sanity restored

#!/usr/bin/perl -- use strict; use warnings; use Wx; my$app=Wx::SimpleApp->new; for(1..10){ for(1..2000){ my $f =Wx::Frame->new; $f->Close; $f->Destroy; undef $f; $app->ProcessIdle; ## CRITICAL ## can also be written as ## Wx::wxTheApp()->ProcessIdle; #~ $app->Dispatch for 1..1000; $app->Dispatch for 1..10; } scalar<>; } __END__

Replies are listed 'Best First'.
Re^14: Detecting memory leaks. ( Wx::wxTheApp()->ProcessIdle; )
by Steve_BZ (Chaplain) on May 14, 2015 at 19:57 UTC

    Hi Anon,

    I actually did $app->Yield, which I guess is similiar to $app->ProcessIdle;,

    However, the key thing was we've now run 90 video tests with no crashes!!

    Thanks a lot for your help, it was nice to know that I wasn't alone. And it was you who directed me to post a bug, which was what brought out this resolution.

    Regards

    Steve.

      Aha, I vaguely recall the existence of Yield :) I'm glad it works in your case, but it doesn't when I replace it with ProcessIdle in the examples I posted, heh