Or you could do it this way...

https://play.golang.org/p/rU2ONi51ec

On Mon, Oct 2, 2017 at 7:26 PM, Unni Krishnan <u...@nilenso.com> wrote:

> I tried FreeOSMemory, didn't make any difference.
>
> On Mon, 2 Oct 2017, 5:26 a.m. Ian Lance Taylor, <i...@golang.org> wrote:
>
>> On Sat, Sep 30, 2017 at 9:29 AM,  <u...@nilenso.com> wrote:
>> >
>> > From what I understand reading and a few comments from the gopher slack,
>> > this is because  go is not releasing memory back to OS but holds it for
>> a
>> > longer in case it needs this, if that makes sense? It would be really
>> > helpful, if someone could help me understand this.
>>
>> Yes, that is what the Go runtime does.  It requests the memory it
>> needs from the operating system.  Every five minutes or so it returns
>> unused memory back to the operating system.  You can make this happen
>> sooner by calling https://golang.org/pkg/runtime/debug/#FreeOSMemory .
>>
>> Note that on modern operating systems unused memory is quite cheap.
>>
>> Ian
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Michael T. Jones
michael.jo...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to