posted 18 years ago
Suppose my GUI application opens a second JFrame (perhaps allowing the user to edit data) and then closes that frame, although the application itself keeps running.
Now, I can "close" that second frame by setting visible to false. But if that's all I do, isn't this a memory leak?
It seems to me that I should create a reference to that second frame in my main application, and then as part of closing the second frame, set that reference to null. This should make the "invisible" frame (and any other objects it contains or references) eligible for garbage collection.
So here's my question: Is my reasoning correct? And is there a standard way to do this?
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org