On Mon, Mar 9, 2009 at 6:51 PM, Eric Wilhelm <[email protected]> wrote:
> # from Gabor Szabo
> # on Monday 09 March 2009 05:12:
>
>>If I run it as it is it leaks about 20-30 bytes per run.
>>If I enabled the event generation code as well which is currently
>>commented out then with each run the RES memory will grow by ~ 600
>> bytes.
>
>>          $file->Destroy( $e );
>
> What if you also call $e->DESTROY here?

then I get

Can't locate object method "DESTROY" via package "Wx::MenuItem" at
menu.pl line 92.

and memory usage fells to 0 ;--)

(quite similar if I call $e->Destroy)


>>               Wx::Event::EVT_MENU(
>>                       $main,
>>                       $menu->Append( -1, $label ),
>>                               sub {
>>                                       eval { $value->(@_) };
>>                               },
>>                       );
>
> This is going to reference $label as long as the sub exists.  I think
> you might have to disconnect the event to free that memory.
>
> On a completely different note:  Why eval {} inside an event sub?

I think it is because these are methods in the plugins and we
try to avoid a crash caused by a plug-in.


Gabor

Reply via email to