in reply to memory leak
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: memory leak
by bob_dobalina (Sexton) on Aug 26, 2009 at 03:31 UTC |