GC out of memory with macro.
Submitted by Tuesday, 19 January, 2010 - 19:29
on
Hi, first message here. I have been using jEdit for a short time. I've found it as a replacement for UltraEdit and coding is not my need.
Running Macros/Scripts is what I need to do from time to time to clean up files coming in different formats.
I've had many memory issues with jEdit. But this is something I can't solve. It seems to be jEdit related but I think some of you may help.
I have a 162MB text file, opening chews about >330MB (the Heap is at 2GB now)
I run this Macro (avoiding some obvious constants and declarations) (SEE BELOW)
It works fine, but the memory ramps to 2GB, stays like that for about 30 minutes until I get a message from BeanShell that GC has run out of heap memory.
As you can see, my code does not "retain" things in memory, so I don't see why it's doing that.
I've set the Autosave time to "0" and Undo to "0".
Thanks!
Running Macros/Scripts is what I need to do from time to time to clean up files coming in different formats.
I've had many memory issues with jEdit. But this is something I can't solve. It seems to be jEdit related but I think some of you may help.
I have a 162MB text file, opening chews about >330MB (the Heap is at 2GB now)
I run this Macro (avoiding some obvious constants and declarations) (SEE BELOW)
It works fine, but the memory ramps to 2GB, stays like that for about 30 minutes until I get a message from BeanShell that GC has run out of heap memory.
As you can see, my code does not "retain" things in memory, so I don't see why it's doing that.
I've set the Autosave time to "0" and Undo to "0".
while (SearchAndReplace.find(view))
{
SearchAndReplace.setSearchString("\\d+\\.\\d+");
SearchAndReplace.find(view); //Find first number in line
strTemp = textArea.getSelectedText(); //Copy to a String
SearchAndReplace.setSearchString("\\s+.*\\s+(?=(\\d|-))");
SearchAndReplace.find(view); //Find some other numbers
textArea.backspace(); //Erase that
//Add spaces until caret gets to the column it should be
while ( (textArea.getCaretPosition()-textArea.getLineStartOffset(textArea.getCaretLine()))
< 19)
{
textArea.setSelectedText(" ");
}
textArea.setSelectedText(strTemp); //Paste the previously copied number
//Add spaces until caret gets to a specified column
while ( (textArea.getCaretPosition()-textArea.getLineStartOffset(textArea.getCaretLine()))
< 32)
{
textArea.setSelectedText(" ");
}
SearchAndReplace.setSearchString("SOME\\s+");
}
Thanks!