in reply to Perl - release memory

After the few minutes are up, the extra 250Mb won't be actively in use, so it will be paged out when other applications need to use the memory. In other words, don't worry about it.

Replies are listed 'Best First'.
Re^2: Perl - release memory
by Tobias Schulz (Novice) on Dec 14, 2008 at 14:38 UTC
    Are you sure? Other applications exit with an "Out of memory error" after exhausting the swap partition. The perl process doesn't release it.

      The obvious solution to that is "increase your swap." Why worry about memory issues when disk space is so cheap? (I get the same problem at $work, too, and it frustrates me to no end - they don't realise that for about 1 day of my pay, they could get a TB of disk space, and practically never worry about swap space again, whereas NOT doing so will cost me weeks in debugging and reorganisation.)

      Now, assuming your IT management is about as sensical as mine, the solution is (probably - we don't really have enough info to be sure) to fork prior to doing the heavy work, and then exit the subprocess when it's done. The subprocess' memory will be freed, but the parent will continue to live and monitor. It's probably the cheapest approach to the problem.

        Swap is slow. But that is also nothing that solves the problem. It's only a workaround.