You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/src/devdocs/gc.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,10 @@ This scheme eliminates the need of explicitly keeping a flag to indicate a full
67
67
## Heuristics
68
68
69
69
GC heuristics tune the GC by changing the size of the allocation interval between garbage collections.
70
-
If a GC was unproductive, then we increase the size of the allocation interval to allow objects more time to die.
71
-
If a GC returns a lot of space we can shrink the interval. The goal is to find a steady state where we are
72
-
allocating just about the same amount as we are collecting.
70
+
71
+
The GC heuristics measure how big the heap size is after a collection and set the next collection to when the heap size is twice as big as the current size or to the maximum heap size.
72
+
The heuristics measure the heap size by counting the number of pages that are in use and the objects that use malloc. Previously we measured the heap size by counting
73
+
the alive objects, but that doesn't take into account fragmentation which could lead to bad decisions, that also meant that we used thread local information (allocations) to make
74
+
decisions about a process wide (when to GC), measuring pages means the decision is global.
75
+
76
+
The GC will do full collections when the heap size reaches 80% of the maximum allowed size.
0 commit comments