This is a creation in Article, where the information may have evolved or changed.
S2: = Append (S1, *)
The slice information recorded on the slice S1 is copied to S2,
1. If the underlying array length that the S1 points to is not sufficient, the append process will take the following actions: Not only is the new area stored in memory a append slice of information, It also requires a new area to store the underlying array (copying the original array into the new array), and then append the new data into the new array, so that S2 points to the new array.
2. If the bottom array length of the S1 point is sufficient,
the result of S2 and S1 pointing to the same array,append is a new area in memory that stores new tile information.
Create an area to store the underlying array using the following strategy:
1. If the added Len < s cap is the cap*2 of the new S
2. If the added Len > s cap is the new s cap = old cap + add data to Len