[go-nuts] Re: discrepancy between goal heap size and NextGC

2024-01-30 Thread Michael Mitchell
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.


[go-nuts] discrepancy between goal heap size and NextGC

2024-01-29 Thread Michael Mitchell
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/91aa0a78-7271-43b5-8fb0-be2f5064b265n%40googlegroups.com.


[go-nuts] pauseEnd times in runtime.Memstats

2024-01-12 Thread Michael Mitchell
In runtime.Memstates, one of the stats given is the timestamps for the last 
256 garbage collections in the PauseEnd array, i.e. when those garbage 
collections took place.

So if you subtract one timestamp from another, you can find out how much 
time took place between garbage collections.

Is there anything else that you do with PauseEnd times?  

-- 
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/54b9e68c-942c-40d4-8373-5e9a8bfc5cbdn%40googlegroups.com.


[go-nuts] garbage collections on Windows and Mac

2024-01-09 Thread Michael Mitchell
Hi,

I have noticed on my macbook pro that HeapInUse is always slightly above 
NextGC when the garbage collection occurs.  

According to mstats.go, the "garbage collector's goal is to keep HeapAlloc 
less than NextGC" and also  according to mstats.go, "HeapInUse minus 
HeapAlloc estimates the amount of memory that has been dedicated to 
particular size classes, but is not currently being used" so it makes 
sense   that HeapInUse rises above NextGC, and also that HeapIdle gets 
smaller as we get closer to NextGC. 

However, on my windows machine, as shown in this attached video, the 
garbage collections are occuring well below the NextGC level.  When the 
number of garabge collections changes from 4 to 5, the number of 
Allocations is well below the nextGC level.
https://youtube.com/shorts/jf6DoEQSnMk?feature=share

 On both the Mac and Windows machine, the nextGC level is the same. 

Question: Why is the garbage collection happening much sooner on the 
Windows than the Mac? 




-- 
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/eec4d7e3-8c07-401e-999d-be0331e6e47en%40googlegroups.com.