On Wed, Aug 9, 2017 at 2:56 AM sno <farleyschae...@gmail.com> wrote:
> In the above code, the capacity prints 32. However, if you comment the
first print statement and remove the commenting on the second and run the
program again the capacity will only be 8. What is happening with
sliceHeader.Data to make its capacity grow like that?
The runtime is free to make the slice of whatever larger-than-required
capacity. The algorithm that picks a suitable memory block in the allocator
is an implementation detail and the choice can be obviously influenced by
the dynamics of the heap. IOW, the example program cannot expect any
particular capacity that can be relied upon or even necessarily
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.