How to implement Memory Pooling in Golang
<p>I implemented an HTTP server in Go.</p>

<p>For each request, I need to create hundreds of objects for a particular struct, and I have ~10 structs like that. So after the request is finished as per Go implementation it will be garbage collected. </p>

<p>So for each request this much amount of memory will be allocated and deallocated.</p>

<p>Instead I wanted to implement memory pooling to improve performance from allocation side as well as GC side also</p>

<p>In the beginning of request, I will take from pool and put them back after the request is served</p>

<p>From the pool implementation side </p>

<ol>
<li>How to allocate and deallocate memory of a particular type of struct?</li>
<li>How keep track of information this memory got assigned and other is not?</li>
</ol>

<p>Any other suggestions to improve performance in case of memory allocation and deallocation?</p>