Capacity is contiguous memory allocated for StringBuilder. Capacity can be> = string length. When more data than volume is added to StringBuilder, StringBuilder automatically increases capacity. Since the bandwidth is exceeded (that is, the continuous memory is full and there is no more buffer room), a large area of the buffer is allocated and data is copied from the original memory to this new area.
It does not copy data to a new "instance", but to a new "memory location". The instance remains the same, but indicates a new memory location.
Change FYI: the default capacity for StringBuilder, if not specified at creation, is 16
If you want to see memory locations for StringBuilder, you can debug your applications and check memory using Debug> Windows> Memory. In fact, you can see the address of each byte stored in your StringBuilder when append stmt starts.
If you need to get seats with software this link may help.
Rashmi pandit
source share