[Melbourne-pm] PERL Destruction and Memory Usage

Brad Bowman list at bereft.net
Sun Jun 20 19:00:44 CDT 2004

$ perldoc -f exit

The exit() function does not always exit immediately. It
calls any defined "END" routines first, but these "END"
routines may not themselves abort the exit. Likewise any 
object destructors that need to be called are called
before the real exit. If this is a problem, you can call
"POSIX:_exit($status)" to avoid END and destructor
processing. See perlmod for details.

On Mon, 2004-06-21 at 08:33, Scott Penrose wrote:
> 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?
> Scott
> - -- 
> * - *  http://www.osdc.com.au - Open Source Developers Conference * - *
> Scott Penrose
> Welcome to the Digital Dimension
> http://www.dd.com.au/
> 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)
> iD8DBQFA1hDFDCFCcmAm26YRAo0XAJ4wnPhoTSPxGKQ/Al3+7lrVdYtlZwCggRmG
> cIvipwzUlN5Y6sh9Joukc2g=
> =tpDV
> _______________________________________________
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
> http://www.pm.org/mailman/listinfo/melbourne-pm
 You cannot tell whether a person is good or bad by his vicissitudes in
 life. Good and bad fortune are matters of fate. Good and bad actions
 are Man's Way. Retribution of good and evil is taught simply as a moral
 lesson.                        -- Hagakure http://bereft.net/hagakure/

More information about the Melbourne-pm mailing list