Scarb
118 天前
之前看到 netty 的三段式 commit message ,觉得挺好,可以参考一下。举个例子
```
Aggressively remove PoolThreadCache references from its finalizer object
Motivation:
If a cache's FastThreadLocalThread owner win the race to remove the cache, due to debugging
capabilities, it's finalizer will still retain a strong reference to it, causing few classes to leak (and eventually, their ClassLoader).
Despite we cannot avoid finalizers to wait the finalization pass, we can reduce the memory footprint of "leaked" instances before the finalization happen.
Modification:
non-debug early cache removal can remove the cache strong reference within FreeOnFinalize, making it an emtpy shell, eligible for GC.
Result:
Smaller memory footprint while waiting finalization to happen
```