Pretty much every experienced garbage collector developer I’ve met hate GC finalization mechanisms and consider them unreliable user-level bug farms
... but they end up implementing them anyway.
@andywingohttps://github.com/tc39/proposal-weakrefs/issues/78 …
-
Show this thread
-
Replying to @awbjs @andywingo
Finalizers are genuinely necessary, though, so it's important to do it well. Particularly in situations where allocated objects can hold on to _allocations_ not tracked by the collector, finalization is the right thing.
4 replies 0 retweets 5 likes -
Replying to @samth @andywingo
Yes, multiple interlinked but independently managed heaps is a classic use case for finalization. But when possible, purpose-built mechanisms specific to that use case is likely better.
2 replies 0 retweets 1 like -
Replying to @awbjs @andywingo
I think this is a place where we generally disagree on the broader language design approach: flexible general mechanism that can be misused vs specific solution that is harder to misuse.
1 reply 0 retweets 0 likes -
Replying to @samth @andywingo
I agree that normally flexible composable general mechanisms are what we want. But a GC isn't a such mechanism. It is an implemented dependent bag of heuristics selected to support a specific set of memory resource management goals.
2 replies 0 retweets 0 likes -
Replying to @awbjs @andywingo
That's true but I don't think relevant. In any language, you need a mechanism to manage general resources when objects die. In a GC'ed language, that's when the collector reclaims them. If your GC heuristics produce bad results in important use cases, they should be tuned.
2 replies 0 retweets 0 likes -
Also the same is true for malloc and free.
1 reply 0 retweets 0 likes -
I can't tell which part of my tweet you mean, but I agree in all cases. :)
1 reply 0 retweets 0 likes
The fact that malloc and free is “an implementation dependent bag of heuristics selected to support a specific set of memory resource management goals”. Modern mallocs even incorporate pseudo-GCs to rebalance thread caches.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.