Just want to make sure I understand this properly:

I have a large dynamic array (whose elements are immutable) which only ever grows. I also have a whole lot of small slices into this array, the slices never change, and they don't span the entire contents of the array (they are just pieces).

Now if I append to the large array, and the runtime needs to re-allocate to accommodate the change in size, none of the pieces of the original array which are referred to by the slices can be freed, right? So I end up basically with two copies of the original large array, however the first version will now have little pieces missing from it (wherever the slices don't refer).

Is that correct?

Reply via email to