Not only is it difficult to code them correctly, but the timing of finalization is not deterministic, and there is no guarantee that finalizers will ever even run.
终结器不仅难以编写正确,终结的定时也是不确定的,并且不能保证终结器最终会运行。
2
If you run your benchmarks with -verbose: gc, you can see how much time was spent in garbage collection and adjust your timing data accordingly.