On Friday, 27 January 2017 at 23:22:17 UTC, Nick Sabalausky wrote:
Suppose an array is being used like a FIFO:
-----------------------
T[] slice;
// Add:
slice ~= T();
// Remove:
slice = slice[1..$];
-----------------------
Assuming of course there's no other references to the memory,
as this gets used, does the any of the memory from the removed
elements ever get GC'd?
Also, if this is a long-running process, isn't there a
potential danger in the array just marching through the address
space and running out of room? (ie either running out of of
continuous space, or hitting 0xFFF....)
It should reclaim the memory from the beginning of the array.
But your could just have written a small tool that does this and
look at the memory use over time.
Generally a good idea, to perform experiments with things you are
interested in.
And there is always the risk of running out of memory on machines
which have no mmu.