Re: Why is a perl script 'sleep 100' uses 100 MEGS of RAM
- From: smallpond <smallpond@xxxxxxxx>
- Date: Fri, 30 Nov 2007 09:25:55 -0800 (PST)
Ignoramus22774 wrote:
I have a Fedora 8 Linux box with 64 bit OS and stock perl.
Just invoking perl executable seems to take 100 MEGS of virtual memory!
That's a huge amount. Here's proof:
work$ perl -e 'sleep 10' & sleep 1; ps -eo pid,vsz,rsz,args|grep perl |grep 'sleep 10'
[3] 15023
15023 98892 1404 perl -e sleep 10
^^^^^^^ virtual memory use
My question is, WTF is going on, why does it need so much memory all of a sudden.
For your information, on my home 32 bit linux box running Fedora 6, it uses 3 megs of VM:
home$
perl -e 'sleep 10' & sleep 1; ps -eo pid,vsz,rsz,args|grep perl |grep 'sleep 10'
[1] 27037
27037 3744 1236 perl -e sleep 10
You are incorrect. The output of ps is in 4K pages, so the VM size is
400MB.
Why do you care how much virtual memory is used?
Look at some of the other programs on a 64-bit system:
2808 218628 18144 /usr/libexec/gdmgreeter
^-- Yes, almost a GB to do the login screen
Neither VSZ nor RSZ mean much. VSZ corresponds to no practical
limit on a 64-bit system, and RSZ includes all linked shared libraries
that
are currently resident. The time needed to add a refcount to 1000
already
resident pages is tiny compared to the time needed to load a single
page of
code from disk, so linking to shared libraries is a very good thing.
If you want to know something more relevant about your process, run
iostat
while it runs and see how many blocks are read from disk in order to
start
your program. Divide the total by 2 and you get the amount of memory
loaded in KB (roughly). I see a few hundred blocks.
--S
.
- Follow-Ups:
- Re: Why is a perl script 'sleep 100' uses 100 MEGS of RAM
- From: Joost Diepenmaat
- Re: Why is a perl script 'sleep 100' uses 100 MEGS of RAM
- References:
- Why is a perl script 'sleep 100' uses 100 MEGS of RAM
- From: Ignoramus22774
- Why is a perl script 'sleep 100' uses 100 MEGS of RAM
- Prev by Date: Re: writing to a notepad in perl
- Next by Date: OT raibow
- Previous by thread: Why is a perl script 'sleep 100' uses 100 MEGS of RAM
- Next by thread: Re: Why is a perl script 'sleep 100' uses 100 MEGS of RAM
- Index(es):
Relevant Pages
|