in reply to memory not freed after perl exits. Solaris.

Your OS may be using the missing memory as file cache.

Once the process exits, the OS frees all the memory allocated by it. AFAIK, the only way to have some allocated memory survive the program is to use shared named memory

Perl will not do that by itself. You will have to request this kind of memory explicitly from your program or use some module that does it.

  • Comment on Re: memory not freed after perl exits. Solaris.

Replies are listed 'Best First'.
Re^2: memory not freed after perl exits. Solaris.
by moritz (Cardinal) on Nov 23, 2010 at 12:37 UTC

    Agreed. Asking the OS for the amount of free memory is mostly useless, since the OS might decide to use large portions for buffering. If you want free memory, don't put it into the computer.

    A better test is to start a program that needs much memory. If it exceeds the amount of "free" memory, the OS starts to give up file caches, and the program start succeeds even though it needs more memory than what was reported as "free".

Re^2: memory not freed after perl exits. Solaris.
by MidLifeXis (Monsignor) on Nov 23, 2010 at 16:22 UTC

    Are you storing data on /tmp, and is it mounted as tmpfs?

    --MidLifeXis