Might it have something to do with the comment in mgc.go about how the increment of memstats.numgc differs from the increment of GC cycles for gctrace? memstats.numgc seems to get incremented earlier (after mark termination) whereas gctrace waits until the sweep is done.
// cycles is the number of completed GC cycles, where a GC // cycle is sweep termination, mark, mark termination, and // sweep. This differs from memstats.numgc, which is // incremented at mark termination. cycles uint32 On Monday, January 29, 2024 at 7:12:53 AM UTC-5 Michael Mitchell wrote: > In the twelfth garbage collection of a short program I ran, GC trace > reports the goal heap size as 735 MB (see below for gc11, gc12 and gc13 > from GC trace) I also checked runtime Memstats (see attached image), and > it says the nextGC target after 12 GCs have run is 838103616. > > Should goal Heap Size of GC Trace and NextGC of runtime.Memstats not be > the same? > > > gc 11 @22.009s 0%: 0.004+12+0.034 ms clock, 0.019+0.13/11/0.94+0.13 ms > cpu, 562->562->367 MB, 964 MB goal, 4 P > > gc 12 @32.925s 0%: 0.003+16+0.024 ms clock, 0.014+0/3.7/13+0.099 ms cpu, > 410->410->399 MB, 735 MB goal, 4 P (forced) > > gc 13 @32.964s 0%: 0.019+21+0.036 ms clock, 0.079+0/21/0.56+0.14 ms cpu, > 400->400->399 MB, 799 MB goal, 4 P (forced) > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/374c3535-f243-43fb-a841-f8717bf85a54n%40googlegroups.com.