|The stupid question is the question not asked|
|( #3333=superdoc: print w/replies, xml )||Need Help??|
According to the Learning Perl book, truncating an array does not recover its memory. To feee memory I need to undef the array like this undef(@array). It also says that the memory doesn't always get free because not many operating systems support this. I find this strange as I've never had this problem in other languages.
I'm using Win2K and not much memory gets free when I undef my array. When I run the script below the @array takes ~76,000K in memory when I hit the breakpoint. After undef(@array) gets executed the memory only goes down to ~72,000K. If I continue the loop and watch memory it'll fluctuate between these two numbers.
Is there another way to free the memory? Does anyone else find this behavior strange? I must be missing something, perhaps some monks can enlighten me.
The memory is even kept after the array goes out of scope.
In reply to Freeing memory used by arrays by monktim