maybe I misread "reallocating", if that means that at some point the whole array is moved (copied) to a formerly released memory location it's fine.
If Perl was only allocating forward after x push and releasing backwards after x shift and the released memory wasn't reused otherwise, then memory consumption for the process would grow.
This I'd call a leak.
It would be interesting to know how and when this reallocation happens and if it's automatically done on C-level.
I now seem to remember (in the context of paging to the disk) that memory management operates on physical blocks or pages which are dispersed over RAM, and translates a virtual address to a physical one. Hence a released block would be naturally reused, without much intervention. :)
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
In reply to Re^4: How to implement a Queue that doesn't leak memory?
by LanX
in thread How to implement a Queue that doesn't leak memory?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |