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 | |
by Anonymous Monk on May 14, 2015 at 23:23 UTC |