in reply to Another memory usage question

Having had your problem just one week ago:
production software consuming memory allocated for an array inside a for loop,
I've searched PM and read the threads on it.

Do a search on "undef array" to see what I (might) have found then.

In short and as a rule of thumb:

I was also asked to test on different behaviour in past Perl versions when freeing memory in arrays. I didn't encounter anything funny from 5.0005_04 through the 5.6es towards 5.8.5.

I used Devel::Size for the perl data and unix's ps command to look at the overall size of the process. The latter produced nothing unexpected: As the array grows, so does the size of the programme in the perl interpreter.
You can't return the used memory to the OS, if that's what you are looking for.
If that's your concern, consider forking a child that will later consume that much memory, and die, freeing the memory then.

Cheers, Sören

Replies are listed 'Best First'.
Re^2: Another memory usage question
by TheMarty (Acolyte) on Oct 08, 2004 at 07:37 UTC
    Thanx. I put "use strict" (YEEES, I KNOW, I've should done this from very beginning), and than I did undef @Array everywhere (almost) where possible. It helped a little bit. 50-60% mem usage less...