about references. Memory leaks are still possible – if an object has a „reachable“ reference (whatever that is in your context) it won’t be garbage collected. You still have to think about who references your objects and how long.
For instance, in my current project using Java Swing, someone said
- getCurrentFocusManager().addKeyEventDispatcher(this)
in a constructor. Then we got reports OutOfMemory-Error. A simple
- getCurrentFocusManager().removeKeyEventDispatcher(this);
solved this issue.
It’s harder than you think!