How to reduce cpu usage when gc,nearly 100%

307 views
Skip to first unread message

林圣国

unread,
Nov 29, 2021, 9:45:03 PM11/29/21
to golang-nuts
After running serveral of days,my program will use 100% cpu when gc,how can I fix this?
The program has millions of objects,hard to reduce.
go version
go version go1.16.3 linux/amd64gc.png
Top and perf top show that runtime gc causes high cpu usage
rule1129.heap

Ian Lance Taylor

unread,
Nov 29, 2021, 11:03:21 PM11/29/21
to 林圣国, golang-nuts
Please always paste plain text as plain text, not as an image.  Plain text is much easier to read.  Thanks.

I recommend starting with https://go.dev/blog/pprof and the description of memory profiling.

Ian

林圣国

unread,
Nov 30, 2021, 1:50:12 AM11/30/21
to golang-nuts
Sorry about that,Google folds the image and the attachment,I already profile the memory heap. 
Reply all
Reply to author
Forward
0 new messages