why need "assist garbage collection" at a GC cycle? (runtime Code)

109 views
Skip to first unread message

ding liu

unread,
Jun 6, 2019, 6:52:22 AM6/6/19
to golang-nuts
I cann`t find any infomation about "assist garbage collection" with google, so what`s the purpose of "assist garbage collection"?

fge...@gmail.com

unread,
Jun 6, 2019, 7:25:08 AM6/6/19
to ding liu, golang-nuts
Maybe the detail you are looking for is something like this:
https://blog.golang.org/ismmkeynote


On 6/6/19, ding liu <liudi...@gmail.com> wrote:
> I cann`t find any infomation about "assist garbage collection" with google,
>
> so what`s the purpose of "assist garbage collection"?
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/9f648a2f-33a2-4097-b503-35ba558f728e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

ding liu

unread,
Jun 11, 2019, 4:32:14 AM6/11/19
to golang-nuts
Thanks, this is. I find some infomation at https://docs.google.com/document/d/1wmjrocXIWTr1JxU-3EQBI6BK6KgtiFArkG47XK73xIQ/edit#

在 2019年6月6日星期四 UTC+8下午7:25:08,Gergely Födémesi写道:
Maybe the detail you are looking for is something like this:
https://blog.golang.org/ismmkeynote


On 6/6/19, ding liu <liudi...@gmail.com> wrote:
> I cann`t find any infomation about "assist garbage collection" with google,
>
> so what`s the purpose of "assist garbage collection"?
>
> --
> 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

Jesper Louis Andersen

unread,
Jun 11, 2019, 9:33:32 AM6/11/19
to ding liu, golang-nuts
Indeed.

If you allocate data faster than the GC mark phase can find and mark it, it enlists the "mutator" (I.e., your program) to assist it in the GC. Roughly, allocations are now followed by some marking work, so the allocation rate doesn't outpace the marking rate.

The solution is to lower your allocation rate in your program, or make the data you have easier to mark by avoiding pointers where a flat storage is more applicable. Also, `sync.Pool` comes to mind as a tool which might be useful, once you've profiled and found the problematic spots.



To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/6599bb70-3aaf-48ed-b17d-fbe997c0242a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
J.
Reply all
Reply to author
Forward
0 new messages