[Ace-users] Memory leak in ACE_Sig_Handlers_Set

teromari at luukku.com teromari at luukku.com
Tue Feb 12 06:42:59 CST 2008

ACE version 5.6.2, Windows XP and VisualStudio 7.1

When application creates a signal handler
    CtrlCSignalHandler pCtrlCSignalHandler(SIGINT);
    ACE_Sig_Handlers aceSignalHandler;
    int intSigKey = aceSignalHandler.register_handler (SIGINT,

runs it
    ACE_Reactor::instance ()->run_reactor_event_loop();

and releases it
    aceSignalHandler.remove_handler(SIGINT, 0 , 0, intSigKey);

168bytes are not released.

Allocation: In sig_handler.cpp line 318 there is check,
if ACE_Sig_Handlers_Set::sig_handlers_[signum] == 0
When true,
new ACE_NEW_RETURN (ACE_Sig_Handlers_Set::sig_handlers_[signum]...
is created.

Release: In sig_handler.cpp line line 502 there is a check,
if (handler_set->size () == 0)
When true,
new_disp->register_action (signum, old_disp)
sets the line 318 check back to true.

The original allocation was never released.

To my understanding simple fix would be to add
delete handler_set;
line somewhere within check,
if (handler_set->size () == 0)

Is my definition/fix correct?

Thank you,


More information about the Ace-users mailing list