[Melbourne-pm] Perl garbage collection behaviour
scottp at dd.com.au
Wed Aug 24 16:41:52 PDT 2005
Hmm... weird. I posted this yesterday morning, wonder why it only
just came through... oh well I will have to ask the list manager - oh
damn, that's me!
On 24/08/2005, at 16:43, Scott Penrose wrote:
> On 24/08/2005, at 16:12, Harley Mackenzie wrote:
>> 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
> It would seem unlikely. My guess is that you are not releasing data
> - or more accurately, some code somewhere in a module somewhere is
> not releasing data.
> For example, you often find modules keeping references to
> themselves or other places - which means that reference count is up
> for that variable. Next time, when you release the previous state,
> you may not have released the reference to itself.
>> Can I initate a garbage collection in the program itself?
> No, it is out of your hands.
> You could use Devel::Size to look at what is going on.
> Hope you get rid of your niggle - hopefully it is not in something
> you have no control over.
> Of course it could always be a bug in Perl - but I would assume
> first that it is your own code - and then a module - and only then
> perl :-)
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
* - * http://www.osdc.com.au - Open Source Developers Conference * - *
Anthropomorphic Personification Expert
scott at cpan.org
Dismaimer: While every attempt has been made to make sure that this
email only contains zeros and ones, there has been no effort made to
guarantee the quantity or the order.
Please do not send me Word or PowerPoint attachments.
Microsoft is not the answer. It's the question. And the answer is no.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://mail.pm.org/pipermail/melbourne-pm/attachments/20050825/e9262bb9/PGP-0001.bin
More information about the Melbourne-pm