But if you only access it via push() and pop(), then there are no other references to the stack, so why should the GC reallocate it on append?

Because the GC doesn't know there aren't any other references to it unless you tell it with assumeSafeAppend.

Reply via email to