Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: memory usage woes

by urufu-san (Novice)
on Nov 21, 2001 at 00:56 UTC ( [id://126637]=note: print w/replies, xml ) Need Help??


in reply to Re: memory usage woes
in thread memory usage woes

I feared as much. Maybe I'll write this thing in C after all..

Replies are listed 'Best First'.
(tye)Re: memory usage woes
by tye (Sage) on Nov 21, 2001 at 21:43 UTC

    C doesn't return freed virtual memory back to the operating system either. Unless you are running out of swap space, this shouldn't be of much concern, however.

    Now, Perl certainly uses more memory than most things. But avoiding Perl because some number that "top" reports that you don't even understand very well might not be the best application of your time. (:

    The two most common measure of memory use are roughly "virtual memory size" and "working set size". The first measures (roughly) how much swap space a process requires while it exists. The second measures (roughly) how much physical memory the process requires to actually get work done.

    These days, if you are worried about running out of swap space, then I strongly suggest you configure more swap space for your system.

    If you are worried about your system running slow (because it wants more physical memory), then you need to look at the working set size, and that size will go down when the process stops using the memory that it still has allocated to its virtual address space (whether the program was written in C or in Perl).

    If you want a process to return memory to the operating system, then you pretty much have to restart the program. You can do that easily in Perl with: exec( $^X, $0, @ARGV );

            - tye (but my friends call me "Tye")
      But, if you follow tye's advice about "exec", keep in mind that (perldoc -f exec):

      Note that `exec' will not call your `END' blocks, nor will it call any `DESTROY' methods in your objects.

      To avoid weird surprises for long-running programs, I usually let them end "manually" after a period of time and then start/restart them with an endless loop in a shell or batch script.

      /J

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://126637]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-04-16 18:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found