[Melbourne-pm] PERL Destruction and Memory Usage

Scott Penrose scottp at dd.com.au
Sun Jun 20 17:33:38 CDT 2004

Hash: SHA1

Hi Ddues

I have a quick question which I can't easily answer or prove either way.

I have a very large data structure in an application. Close to 100MB. 
All made up of objects. I then fork a number of times, and the used 
memory does not increase as it is still sharing that memory (standard 
vfork = copy on write).

Over the life time of the child the object does not increase much.

Then I do a "exit 0;"

This tends to take a very long time. Perl then calls DESTROY on every 
single object in memory.

So the problem... I have a theory that during the DESTROY that perl 
writes to the memory block, and I end up taking up the 100MB extra for 
each child being destroyed. Thus enough of these happen at once swap is 
hit and everything slows down.

Also, does  perl do garbage collection during an exit ?

Two questions:

* Is this the case, or does perl leave those blocks alone on DESTROY?
* Is there an easy "correct" way to exit a child without activating the 
DESTROY or Garbage collection?

- -- 
* - *  http://www.osdc.com.au - Open Source Developers Conference * - *
Scott Penrose
Welcome to the Digital Dimension
scottp at dd.com.au

Dismaimer: Contents of this mail and signature are bound to change 
randomly. Whilst every attempt has been made to control said 
randomness, the author wishes to remain blameless for the number of 
eggs that damn chicken laid. Oh and I don't want to hear about 
butterflies either.

Please do not send me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
Version: GnuPG v1.2.4 (Darwin)


More information about the Melbourne-pm mailing list