[Melbourne-pm] Perl garbage collection behaviour

Harley Mackenzie hjm at bigpond.com
Tue Aug 23 23:12:21 PDT 2005

I have an application that I have developed that regularly polls a database table for new records, sleeps for most of the time and otherwise periodically generates some reports and faxes. The application works fine except for the memory behaviour, wheret 8KB of memory is used up for each database poll (running on Windows Server 2003) as reported by Windows task manager, with the memory requirements starting out at about 5 KB and over a couple of days eventually exhausting all of the available virtual memory and causing mayhem on the server.

I initially suspected a circular reference in my Perl objects, except for the fact that if 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.

As this is a remote server at a client location this is pretty inconvenient and has resulted in some nasty out of hours phone calls.

Am I correct in assuming that there cant be circular references preventing the reclamation of memory as it reclaims the memroy when the application comes to the foreground?

Why is this bizarre behaviour occuring at all with the garbage collection? Is it because it is in a sleep state for most of the time?

Can I initate a garbage collection in the program itself?


Harley Mackenzie

     Dr. Harley Mackenzie         ACN:   087 953 839
                                  ABN:   27 087 953 839
     HARD Software                Web:   www.hardsoftware.com
     207 Noble Street             Tel:   +61 3 5222 3435
     Newtown 3220, Australia      Email: hjm at hardsoftware.com

More information about the Melbourne-pm mailing list