summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-01-15 11:43:14 +0000
committeracolyer <acolyer>2004-01-15 11:43:14 +0000
commitb3b1eecf938fdc9d0bd8f954bc05ec38763299fb (patch)
tree16e5a9963d54a830727ad18964a56600d18ca345
parent25ba5aa7a906ab4884276b5f15abb8b82304faca (diff)
downloadaspectj-b3b1eecf938fdc9d0bd8f954bc05ec38763299fb.tar.gz
aspectj-b3b1eecf938fdc9d0bd8f954bc05ec38763299fb.zip
Fix for Bugzilla Bug 36234
out of memory error when compiling
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
index 287508440..2be51cb6d 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
@@ -67,6 +67,14 @@ public class Main {
+ "at http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ" + LangUtil.EOL
+ "To make the bug a priority, please include a test program" + LangUtil.EOL
+ "that can reproduce this exception." + LangUtil.EOL;
+
+ private static final String OUT_OF_MEMORY_MSG
+ = "AspectJ " + Version.text + " ran out of memory during compilation:" + LangUtil.EOL + LangUtil.EOL
+ + "Please increase the memory available to ajc by editing the ajc script " + LangUtil.EOL
+ + "found in your AspectJ installation directory. The -Xmx parameter value" + LangUtil.EOL
+ + "should be increased from 64M (default) to 128M or even 256M." + LangUtil.EOL + LangUtil.EOL
+ + "See the AspectJ FAQ available from the documentation link" + LangUtil.EOL
+ + "on the AspectJ home page at http://www.eclipse.org/aspectj";
/** @param args the String[] of command-line arguments */
public static void main(String[] args) throws IOException {
@@ -153,7 +161,16 @@ public class Main {
ourHandler.setInterceptor(MessagePrinter.TERSE);
}
}
- run(args, holder);
+
+ // make sure we handle out of memory gracefully...
+ try {
+ // byte[] b = new byte[100000000]; for testing OoME only!
+ run(args, holder);
+ } catch (OutOfMemoryError outOfMemory) {
+ IMessage outOfMemoryMessage = new Message(OUT_OF_MEMORY_MSG,null,true);
+ holder.handleMessage(outOfMemoryMessage);
+ systemExit(holder); // we can't reasonably continue from this point.
+ }
boolean skipExit = false;
if (useSystemExit && !LangUtil.isEmpty(args)) { // sigh - pluck -noExit