Re: [go-nuts] Force garbage collection return idle memory back to the system

1,937 views
Skip to first unread message

Dave Cheney

unread,
Nov 8, 2013, 5:53:37 PM11/8/13
to Eric Z, golan...@googlegroups.com
If you are using 1.2rc3 you can try 


I do not remember if it is available in older versions. 

Why do you need memory returned to the operating system, how will that help the operation of your go program ?

On 9 Nov 2013, at 9:46, Eric Z <hadoo...@gmail.com> wrote:

Hello there,

Is there anyway I can force the garbage collection to release the idle memory? I could call runtime.GC(), but that routine only mark what memory is not inuse. I still have to wait 5 min defined in mheap.c for the memory to return. I hope I could force the runtime to return the idle memory immediately.

A little bit more background. I am doing something like a merge sort with data size larger than my memory. Since it is not a in-place algorithm, I have to keep make a new slice to merge old two, and hope garbage collector could return the old two back to system memory. If the return in not in time, it will cause more trips to disk which significantly degrade the performance. That's why I hope the idle memory shown by "scvg: GC forced" could be released immediately.

Thanks a lot.

Cheers,
Zheng

--
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...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Eric Z

unread,
Nov 8, 2013, 6:39:00 PM11/8/13
to golan...@googlegroups.com, Eric Z
Thank you very much Dave.
Reply all
Reply to author
Forward
0 new messages