Slices and array appending

cal callumenator at gmail.com
Sun Oct 21 23:09:18 PDT 2012


On Monday, 22 October 2012 at 04:59:41 UTC, Jonathan M Davis 
wrote:
> Blocks of memory are allocated and freed as a whole. When an 
> array is forced
> to be reallocated, then a new block of memory is allocated for 
> it, and any
> existing slices continue to refer to the original block of 
> memory. The
> original block will not be freed until there are no more slices 
> which refer to
> it. You really should read this article if you want to know how 
> arrays work in
> D:
>
> http://dlang.org/d-array-article.html
>
> - Jonathan M Davis

Ah thanks, I didn't realize the _entire_ original array would 
hang around. That makes my current approach really dumb. Cheers




More information about the Digitalmars-d-learn mailing list