D
Devian
Hi,
I am getting OutOfMemory exception in my database application done
with JBuilder 9.0.In that application a main frame which is a main
window for that application has a jTree.When a tree node is clicked in
that tree the related jFrame opens by finding the class.And when the
opened frame closed dbDisposeMonitor(which is a member of the opened
frame) works but the memory usage of the program never decreases.Some
part of the suspicious code is here :
// opens Frame
// FormInfo is the selected node's related class it holds the frame
name which will be opened
private void OpenFrame(FormInfo f)
{
String sFullName = "package." + f.GetFormName();
int iFrmIdx;
for(iFrmIdx = 0; iFrmIdx < FRM_COUNT; ++iFrmIdx){
// Forms is an FormInfo array which is defined in the class of
main frame
if(Forms[iFrmIdx] == null)
continue;
if(Forms[iFrmIdx].GetFormName().matches(f.GetFormName()))
break;
}
try
{
// Frames is a MyFrame class(inherited by jFrame) whic is
defined in the class of main frame
Frames[iFrmIdx] = (MyFrame)
Class.forName(sFullName).newInstance();
Frames[iFrmIdx].SetFormIndex(iFrmIdx);
Frames[iFrmIdx].setTitle(Forms[iFrmIdx].GetFormTitle());
// The frame which is related to f will be kept in Frames
array for disposing.
Frames[iFrmIdx].pack();
Frames[iFrmIdx].setBounds(jPanel1.getBounds());
Frames[iFrmIdx].setLocationRelativeTo(jPanel1);
Frames[iFrmIdx].show();
f.SetOpenStatus(true);
}
catch(ClassNotFoundException eClsExc)
{
eClsExc.toString();
}
catch(InstantiationException eInsExc)
{
eInsExc.toString();
}
catch(IllegalAccessException eIllAcc)
{
eIllAcc.toString();
}
}
While the opened frame is closing Frames[iFrmIdx] is set to null.And
all of the components of the frame is set to null.But the memory
leakage problem goes on.Finally gc() is closed after the frame closed
but this dos not solve the problem.
Any advice?
Thanks
I am getting OutOfMemory exception in my database application done
with JBuilder 9.0.In that application a main frame which is a main
window for that application has a jTree.When a tree node is clicked in
that tree the related jFrame opens by finding the class.And when the
opened frame closed dbDisposeMonitor(which is a member of the opened
frame) works but the memory usage of the program never decreases.Some
part of the suspicious code is here :
// opens Frame
// FormInfo is the selected node's related class it holds the frame
name which will be opened
private void OpenFrame(FormInfo f)
{
String sFullName = "package." + f.GetFormName();
int iFrmIdx;
for(iFrmIdx = 0; iFrmIdx < FRM_COUNT; ++iFrmIdx){
// Forms is an FormInfo array which is defined in the class of
main frame
if(Forms[iFrmIdx] == null)
continue;
if(Forms[iFrmIdx].GetFormName().matches(f.GetFormName()))
break;
}
try
{
// Frames is a MyFrame class(inherited by jFrame) whic is
defined in the class of main frame
Frames[iFrmIdx] = (MyFrame)
Class.forName(sFullName).newInstance();
Frames[iFrmIdx].SetFormIndex(iFrmIdx);
Frames[iFrmIdx].setTitle(Forms[iFrmIdx].GetFormTitle());
// The frame which is related to f will be kept in Frames
array for disposing.
Frames[iFrmIdx].pack();
Frames[iFrmIdx].setBounds(jPanel1.getBounds());
Frames[iFrmIdx].setLocationRelativeTo(jPanel1);
Frames[iFrmIdx].show();
f.SetOpenStatus(true);
}
catch(ClassNotFoundException eClsExc)
{
eClsExc.toString();
}
catch(InstantiationException eInsExc)
{
eInsExc.toString();
}
catch(IllegalAccessException eIllAcc)
{
eIllAcc.toString();
}
}
While the opened frame is closing Frames[iFrmIdx] is set to null.And
all of the components of the frame is set to null.But the memory
leakage problem goes on.Finally gc() is closed after the frame closed
but this dos not solve the problem.
Any advice?
Thanks