unique: N layers of nested unique.Handle
take N GC cycles to reclaim
#71846
Labels
Milestone
unique.Handle
take N GC cycles to reclaim
#71846
Because of the internal representation of
unique
values, making chains of Nunique.Handle
s requires at minimum N GC cycles to reclaim. The root of the issue is the fact that we store canonical values in something like amap[T]weak.Pointer[T]
. They key in the map keeps handles further down the chain alive until they're removed from the map.We can fix this by using a more bespoke data structure that only stores canonical values as
weak.Pointer[T]
and nothing else, as in https://go.dev/cl/650256.Below is a demonstration of the issue.
https://go.dev/cl/650256 resolves this issue.
The text was updated successfully, but these errors were encountered: