<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>allocation on Golang</title><link>https://golang.k5kc.com/tags/allocation/</link><description>Recent content in allocation on Golang</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 16 Aug 2020 00:10:00 +0530</lastBuildDate><atom:link href="https://golang.k5kc.com/tags/allocation/index.xml" rel="self" type="application/rss+xml"/><item><title>Reallocating underlying array of slice</title><link>https://golang.k5kc.com/2020/08/16/reallocating-underlying-array-of-slice/</link><pubDate>Sun, 16 Aug 2020 00:10:00 +0530</pubDate><guid>https://golang.k5kc.com/2020/08/16/reallocating-underlying-array-of-slice/</guid><description>When appending data into slice, if the underlying array of the slice doesn&amp;rsquo;t have enough space, a new array will be allocated. Then the elements in old array will be copied into this new memory, accompanied with adding new data behind. So when using Go built-in append function, you must always keep the idea that &amp;ldquo;the array may have been changed&amp;rdquo; in mind, and be very careful about it, otherwise, it may bite you!</description></item></channel></rss>