develooper Front page | perl.perl5.porters | Postings from August 2001

Re: garbage collection on exit?

Thread Previous | Thread Next
From:
Benjamin Stuhl
Date:
August 16, 2001 08:01
Subject:
Re: garbage collection on exit?
Message ID:
20010816150148.14208.qmail@web14508.mail.yahoo.com
--- Armin Obersteiner <armin@xos.net> wrote:
> > > in short: i hab a 600M hash-of-arrays-of-hashes. 500M
> > > pysically.
> > > i fill up the hash: 80 seconds, i calculate
> something: 10
> > > seconds,
> > > then: exit. the whole procedure takes 15 minutes
> more.
> > > (perl 5.6, no modules used
> > > execpt strict)
> > > 
> > > after i filled in some print statements, i now know
> where
> > > it happens:
> > > at the exit.
> > > 
> > > with a 'system "kill -9 $$"' as last line the program
> > > just takes 90 seconds. 
> > > (as expected)
> > > 
> > > is there some garbage collection taking place? it
> seems
> > > unnecessary at the end,
> > > doesn't it?

Got another idea. This could be as simple as the fact that
you're exiting normally. I'm not entirely sure, but I seem
to remember that glibc itself releases all its memory on
exit(), causing the kernel to have to touch and then
release all the mappings (whereas the kernel simply blows
everything away when a process is killed). One thing you
could try is to add a 'use POSIX ();' at the beginning and
a 'POSIX::_exit(0);' at the end, thereby short-circuiting
glibc's shutdown stuff. Just be sure that all your I/O
buffers are flushed first.

-- BKS

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About