Re: Why is a perl script 'sleep 100' uses 100 MEGS of RAM



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
.



Relevant Pages

  • Re: how much swap size did you take?
    ... virtual memory is used to contain executing processes. ... processes than can fit into real storage. ... to allocate a corresponding page on disk. ... This "duplicate" allocation scenario requires that amount ...
    (alt.os.linux.redhat)
  • Re: how much swap size did you take?
    ... virtual memory is used to contain executing processes. ... I created lazy allocate ... ... to allocate a corresponding page on disk. ... This "duplicate" allocation scenario requires that amount ...
    (alt.os.linux.redhat)
  • Re: Code density and performance?
    ... programs for better virtual memory characteristics. ... 370 was initially announced with only real storage. ... packing in small real storage configurations. ... size was more than offset by the overhead of the smaller disk transfer ...
    (comp.arch)
  • Re: Virtual memory
    ... A common cause of low virtual memory message is that you have insufficient ... How large is your hard disk and how much free ... The Windows XP files alone can take around 3 gb. ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: Recd pop up notice re virtual memory
    ... At present the free disk space of 10 gb exceeds 50%, ... Performance Settings, Advanced, Virtual Memory, Change and place the ... "system managed size" will that let Windows allot the correct memory ... How large is your hard disk and how much free disk space. ...
    (microsoft.public.windowsxp.basics)