[Bioclusters] BioPerl and memory handling

James Cuff jcuff at broad.mit.edu
Tue Nov 30 15:17:55 EST 2004


Sigh.

All depends on your OS.  Here are two versions of the same code that 
Ian posted, the first w/o the undef and the other with.  Both with a 
while(1==1) to make it hang around, to see with ps.

bink:~ jcuff$ uname -a
Darwin bink 7.6.0 Darwin Kernel Version 7.6.0: Sun Oct 10 12:05:27 PDT 
2004; root:xnu/xnu-517.9.4.obj~1/RELEASE_PPC  Power Macintosh powerpc
bink:~ jcuff$ ps aux | grep perl
jcuff  12609  98.3 18.8   223704 196832 std  R     3:04PM   0:02.43 
perl ./test.
jcuff  12603  98.1  9.5   126044  99180 std  R     3:04PM   0:22.05 
perl ./test.


3:09pm jcuff at lead ~ > uname -a
Linux lead 2.4.18-24.7.xsmp #1 SMP Fri Jan 31 06:10:55 EST 2003 i686 
unknown
3:09pm jcuff at lead ~ > ps wwaux | grep test.pl
jcuff    18612 95.2  4.9 197952 196420 pts/42 R   15:09   0:12 
/util/bin/perl ./test.pl
jcuff    18619 52.8  2.5 100288 98760 pts/42 R    15:09   0:04 
/util/bin/perl ./test.pl


tryptophan# uname -a
FreeBSD tryptophan 4.10-RELEASE-p3 FreeBSD 4.10-RELEASE-p3 #0: Wed Sep 
29 14:08:46 EDT 2004     
root at tryptophan:/usr/obj/usr/src/sys/TRYPTOPHAN  i386
tryptophan# ps aux | grep perl
root    41538 96.3  4.9 197404 197156  p1  R     3:11PM   0:07.22 perl 
test.pl
root    41540 91.2  2.5 99808 99468  p1  R     3:11PM   0:02.44 perl 
test.pl

# uname -a
SunOS sun 5.10 s10_69 sun4u sparc SUNW,Ultra-5_10
# ps -eadfl | grep test
  0 R     root  3003  2996  49  69 20        ?  24820          15:12:07 
pts/3       1:00 perl ./test.pl
  0 R     root  3005  2996  49  79 20        ?  24820          15:12:14 
pts/3       0:52 perl ./test.pl

3:05pm jcuff at bismuth ~ > uname -a
OSF1 bismuth.broad.mit.edu V5.1 2650 alpha alpha
3:05pm jcuff at bismuth ~ > ps aux | grep test.pl
jcuff        220249 97.8  4.7  260M 191M pts/3    R    15:05:37     
0:08.85 ./test.pl
jcuff        220252 68.7  4.7  260M 191M pts/3    R    15:05:42     
0:03.16 ./test.pl


So basically Tru64 and Solaris 10 wire in the memory until the process 
ends.  Linux, OSX and FreeBSD let it go, well as Ian said, half of it 
:-)

j.


On Nov 30, 2004, at 10:57 AM, Ian Korf wrote:

> Perl does give memory back to the OS. If I do
>
> my $dna = 'N' x 100000000;
>
> the memory footprint is 192 MB.
>
> undef $dna;
>
> restores half the memory. This is not within a subroutine, but within 
> the main program.
>
>
--
James Cuff, D. Phil.
Group Leader, Applied Production Systems
The Broad Institute of MIT and Harvard. 320 Charles Street,
Cambridge, MA. 02141.  Tel: 617-252-1925  Fax: 617-258-0903




More information about the Bioclusters mailing list