Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Memory is not released back to operating system

by educated_foo (Vicar)
on Mar 02, 2012 at 18:33 UTC ( #957528=note: print w/replies, xml ) Need Help??

in reply to Memory is not released back to operating system

Sorry, that's just the way your malloc() works. Some mallocs use mmap() for large allocations, to at least give the process a chance to return memory to the OS, but most hold onto memory until the process exits.
  • Comment on Re: Memory is not released back to operating system

Replies are listed 'Best First'.
Re^2: Memory is not released back to operating system
by Argel (Prior) on Mar 02, 2012 at 21:48 UTC
    I thought perl specifically tries to hold onto memory so it can reuse it again instead of having to allocate new memory?

    Elda Taluta; Sarks Sark; Ark Arks
    My deviantART gallery

      No, it defers to the implementation of the C runtime library malloc.

      Though I wouldn't recommend it unless you are desperate, it is possible to change the "release memory to the OS" behaviour by building Perl using a custom malloc.

      This has been discussed here many times before, see for example: Not able to release memory and How to return unused memory to OS?.

      From my testing across a number of OSes, I would expect only Linux and Windows to return "large" blocks of memory back to the OS. I would be interested to learn what operating system the OP is running on.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2023-04-02 11:59 GMT
Find Nodes?
    Voting Booth?

    No recent polls found