in reply to Re^3: How to implement a Queue that doesn't leak memory?
in thread How to implement a Queue that doesn't leak memory?
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: How to implement a Queue that doesn't leak memory?
by eyepopslikeamosquito (Archbishop) on Feb 04, 2024 at 02:13 UTC | |
Re^5: How to implement a Queue that doesn't leak memory?
by Anonymous Monk on Feb 05, 2024 at 14:19 UTC |