Will the array of 100 objects and hash in the sub GetObjs be reclaimed/re-used or will another chunk of memory for 100 objects be taken every call to this sub?
Yes. Once there are no longer any references to a variable ( as would happen to @objects, $object, %ht ) they will be destroyed. This won't give the memory back to the OS, but perl will re-use it internally.
If you aren't using them, you should be using 'strict' and probably 'warnings' because it may point out places where you are accidentally using a global variable where you didn't mean to.
The code you posted doesn't run out of memory for me.
In reply to Re: memory leak
by alexlc
in thread memory leak
by bob_dobalina
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |