popFront causing more memory to be used

bearophile bearophileHUGS at lycos.com
Tue Jul 3 06:29:51 PDT 2012


ixid:

> Given popFront is advancing a range does this mean the 
> underlying array is not being deleted? How would one delete the 
> information you don't need any more if so?

I think the GC can't deallocate part of an array. It's a single 
memory zone, and it has to go all at once.

Maybe you need a fitter data structure, like a deque, like the 
Python collections.deque:
http://docs.python.org/library/collections.html#collections.deque

Or similar data structure of C++:
http://www.cplusplus.com/reference/stl/deque/

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list