Details
Description
If an inner class does not need to reference its enclosing instance, it can be static. This prevents a common cause of memory leaks and uses less memory per instance of the enclosing class.
Came across DataNodeProperties as a non static inner class defined in MiniDFSCluster without holding any implicit reference to MiniDFSCluster. Taking this opportunity to find other non-static inner classes that are not holding implicit reference to their respective enclosing instances.
Attachments
Issue Links
- links to