Comment

Comment by shemnon42

Java does memory recovery strictly by garbage collection. To delete an object remove all references to that object and wait.

A "delete now" operation imposes requirements on implementations that are not strictly required.

Any advantages gained from destructors can be realized via explicit cleanup methods and (as a hedge against mis-use) state checking for initialized and destroyed objects. A delete operation also adds risk that an object that has been deleted may be referenced again (although with esoteric stuff like PhantomReferences you can almost do it).

parent shemnon42 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton