Use the cap builtin function to get the capacity of the slice each time. The capacity is the full length of the allocated array that the slice points into. The first append call sees that a is nil and so it allocates a slice with a capacity of 1 to hold the one element. Your next append sees there’s not enough capacity for the next element, so it allocates another backing array, 2x the capacity of the first (until you start getting to huge capacities, then it switches to growing linearly) copies the first array’s element(s) into it and then appends to it. If you initialize a with make([]int, 0, 2), then the backing array will start with the right capacity and the address of a[0] won’t change after appending the first 2 elements.