2020-09-21 18:36:49	hsyl20	wz1000 my guess would be that if a weak pointer uses a statically allocated closure (cf rts/StgMisClosures.cmm) as key it is never freed. But I may be wrong
2020-09-21 18:37:42	@bgamari	wz1000, I wouldn't use WeakPtr keyed on Int
2020-09-21 18:38:13	@bgamari	a good rule of thumb is that weak pointers should only be used against unlifted things
2020-09-21 18:38:24	wz1000	hmm. what about `Maybe Int`? Or `Unique`?
2020-09-21 18:38:27	@bgamari	nope
2020-09-21 18:38:43	@bgamari	wz1000, Anything which might be reboxed is problematic
2020-09-21 18:38:56	@bgamari	and GHC is free to rebox any standard ADT
2020-09-21 18:39:09	@bgamari	the only things that it can't rebox are those things with identity
2020-09-21 18:39:14	@bgamari	likes MutVar# and ByteArray#
2020-09-21 18:39:34	@bgamari	see https://gitlab.haskell.org/ghc/ghc/-/issues/18199
2020-09-21 18:39:43	wz1000	are those the only things I can use then?
2020-09-21 18:40:01	@bgamari	s/ByteArray#/MutableByteArray#
2020-09-21 18:40:15	@bgamari	any unlifted mutable thing should be safe
2020-09-21 18:41:57	wz1000	And I have to use MutVar#, not MutVar?
2020-09-21 18:42:09	@bgamari	yes
]
