in reply to Re: Event.pm memory leek ?
in thread Event.pm memory leek ?

This does not look correct, because :
- signal is masked in own callback (normal Unix behaviour, tested this is ok in Event.pm as well)
- if you change printf on print or even syswrite, memory leak will still exist
- similar code works fine in test without Event.pm (using %SIG)

Update: code like
use Event; Event->signal(signal=>'HUP', cb=>sub {kill 1, $$}); kill 1, $$; Event::loop;
produce memory leak as well :)

Replies are listed 'Best First'.
Re^3: Event.pm memory leek ?
by cazz (Pilgrim) on Apr 22, 2005 at 19:49 UTC
    Ok, so not only does your code malloc inside a signal handler, so does Event.

    Well, Event.xs shows that when signal is called, it does copying.

    _signal_signal(THIS, items == 2? sv_mortalcopy(ST(1)) : 0);
    sv_mortalcopy mallocs. Since you are calling the signal handler from inside the signal handler, it never frees that memory. Simple solution: Don't call the signal handler from inside the signal handler.