dynamic array memory allocation

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Wed May 16 08:01:23 PDT 2007


Greg Weber wrote:
> Thanks, that is very useful.  So the next question becomes how can I re-size a dynamic array down to a smaller length and guarantee that (most of) the memory has been freed?

AFAIK there's no way to shrink the memory allocated to an array, and the 
closest you can get is to call .dup on a slice. This will get you a copy 
of part of the array, allowing the original to be garbage collected 
(assuming no more references to it exist).



More information about the Digitalmars-d mailing list