There are two reason GC is heavy:

a) Many garbages are created very frequently.
b) There are many (living) objects GC need to scan every time.  (Because 
Go's GC is not generational)

Finding bottleneck of (a) is easy.  `pprof -alloc_objects ...` tell you 
where many objects are allocated.

(b) is difficult than (a).  First of all, you should understand Go's GC 
only scans pointers.

For example, when there is `times := make([]time.Time, 10000)`, GC need to 
scan in the times,
because time.Time has a pointer.
You can avoid the scanning by converting Time to int64 using 
Time.unixnano().
GC doesn't scan in []int64.

Then, you need to find where many pointers are alive.
pprof doesn't provide you direct answer.  But `pprof -inuse_space` and 
`pprof -inuse_objects`
gives you great hint.

Best,

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5486d296-f75a-466e-a2df-647682f8c982%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to