[Melbourne-pm] Perl garbage collection behaviour

Mathew Robertson mathew.robertson at redsheriff.com
Wed Aug 24 17:11:52 PDT 2005

I have been on a GUI toolkit list for some time... Quite a while ago, it 
was found that when a window is minimized, it is possible for the win32 
subsystem to not deliver some messages to the event loop.

This problem manifests itself when the GUI library uses WM_TIMER 
messages combined with the MsgWaitForMultipleObjects() function call.  
ie: GUI toolkits tend to use the function call to block for user input, 
and they use WM_TIMER to set a timeout value (eg: in your case 5 
seconds).  When the window is minimised, no timers are sent.  As such, 
it appears that the Perl garbage collector is not executing until a 
WM_RAISE event is sent.

An example can be found here:  
Notice that the solution is to forcibly make your own message using 
something like .. "PostMessage(WM_KICKIDLE)"

So in essence, win32 can cause minimised tasks to misbehave.

>>I click on the application that is usually running in a minimised state at the bottom of the screen, and bring it to the foreground, and then minimise again, something kicks off the garbage collection and it then reduces to about 5KB and starts the memory accumulation thing all over again.

More information about the Melbourne-pm mailing list