in reply to Re: Garbage Collection on Hash delete
in thread Garbage Collection on Hash delete

CountZero got the point
=>PERL will not release any memory back to the operating system as long as the script runs
My script is should run forever and that's why I cannot just terminate the programm or go out of a block.
Will Perl release the memory if delete is used ?
netoli
  • Comment on Re: Re: Garbage Collection on Hash delete

Replies are listed 'Best First'.
Re^3: Garbage Collection on Hash delete
by Aristotle (Chancellor) on Jan 12, 2003 at 16:45 UTC
    So long as you don't use excessive amounts of memory, it shouldn't be a problem. Any way you clear the hash, the memory will be returned to Perl's pool. Even though Perl doesn't give any of its pool back to the OS, it will recycle memory from the pool for later use in the script. So if you accumulate a lot of data in the hash, the Perl process will grow by (say) 1MB, and not shrink again even if you clear the hash. However, if you fill the hash again, the Perl process will not grow again - it will simply reuse the memory it had allocated before.

    Makeshifts last the longest.