I have a JFrame and I open a JDialog from it and another JDialog from that dialog – which menas i have 3 windows visible (JFrame, JDialog1, Jdialog2).
When I close both dialogs and run a garbage collectior few times (from netbeans profiler)
I can see that JDialog2 (the one opened from JDialog1) is garbage collected but JDialog1 (opened from JFrame) is still hanging in live objects pool.
I create new objects every time – so after some time I have an OutOfMemoryError doue to memory leak.
Do I have to treat JDialogs in som special way so they don’t leak ?
by the way
i do setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE)
on both dialogs,
In order to release allocated resources you have to call the dispose method. Simply hiding the dialog is not enough.