Bookmark Topic Watch Topic
  • New Topic

How to solve OutOfMemoryException ??  RSS feed

 
Raj Sikka
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,
I have one method which is called 4000 times (say).
I am getting OutOfMemoryException on calling the method for 4000 times.
Is there any error in my method .
Is there any way to take care of OutOfMemoryException in my method??
Please suggest.
My method is as follows.
protected void replaceSpecificComboBoxEditor(List l, int row, int column)
{
DefaultCellEditor editor = new DefaultCellEditor
(new JComboBox(l.toArray()));
removeCellEditor(row, column);
addCellEditor(row, column, editor);
}
I have also tried the following .Still the problem is coming .
protected void replaceSpecificComboBoxEditor(List l, int row, int column)
{
DefaultCellEditor editor = new DefaultCellEditor
(new JComboBox(l.toArray()));
removeCellEditor(row, column);
addCellEditor(row, column, editor);
//added the following lines.
editor = null;
System.gc();
}
Is there any way to force the garbage collector to collect unused object references ?
TIA for the suggestions.
Raj
 
Jeroen Stroom
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
I think you posted the same question already in Java in General (intermediate).

Jeroen
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!