Announcement Announcement Module
No announcement yet.
OutOfMemoryError when compiling aspectj Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • OutOfMemoryError when compiling aspectj

    I am using Roo to reverse engineer a postgres database with 107 tables, and using the 'gwt setup' command to generate the gwt configuration and UI pages. All this works ok until it comes to compiling. When Maven does its build it creates a separate java.exe process (from within STS) that seems limited to 256m of memory used. After a few min on the aspectj:compile process an OutOfMemour error is thrown. Is there a way to increase the memory allocated to the newly spawned java.exe process used for compiling?

    I have also setup a Ubuntu 10.x box with Continuum on it as a build server and it also reports out of memory errors when doing the aspectj:compile goal. I have edited the 'bin/mvn' script to set Xmx to 1024m and XX:MaxPermSize to 512m.

    Any ideas on how to resolve this problem would be very much appreciated.

    [INFO] [aspectj:compile {execution: default}]
    [ERROR] Internal compiler error
    java.lang.OutOfMemoryError: Java heap space
            at org.aspectj.apache.bcel.classfile.Attribute.readAttribute(
            at org.aspectj.apache.bcel.classfile.AttributeUtils.readAttributes(
            at org.aspectj.apache.bcel.classfile.FieldOrMethod.<init>(
            at org.aspectj.apache.bcel.classfile.Method.<init>(
            at org.aspectj.apache.bcel.classfile.ClassParser.readMethods(
            at org.aspectj.apache.bcel.classfile.ClassParser.parse(
            at org.aspectj.weaver.bcel.BcelWorld.lookupJavaClass(
            at org.aspectj.weaver.bcel.BcelWorld.resolveDelegate(
            at org.aspectj.weaver.World.resolveToReferenceType(
            at org.aspectj.weaver.World.resolve(
            at org.aspectj.weaver.World.resolve(
            at org.aspectj.weaver.bcel.BcelObjectType.getSuperclass(
            at org.aspectj.weaver.ReferenceType.getSuperclass(
            at org.aspectj.weaver.patterns.ExactAnnotationTypePattern.matches(
            at org.aspectj.weaver.patterns.ExactAnnotationTypePattern.matches(
            at org.aspectj.weaver.patterns.ExactTypePattern.matchesExactly(
            at org.aspectj.weaver.patterns.TypePattern.matchesSubtypes(
            at org.aspectj.weaver.patterns.TypePattern.matchesSubtypes(
            at org.aspectj.weaver.patterns.TypePattern.matchesSubtypes(
            at org.aspectj.weaver.patterns.TypePattern.matchesSubtypes(
            at org.aspectj.weaver.patterns.ExactTypePattern.matchesSubtypes(
            at org.aspectj.weaver.patterns.TypePattern.matchesStatically(
            at org.aspectj.weaver.patterns.DeclareParents.match(
            at org.aspectj.weaver.patterns.DeclareParents.findMatchingNewParents(
            at org.aspectj.weaver.bcel.BcelWeaver.applyDeclareParents(
            at org.aspectj.weaver.bcel.BcelWeaver.weaveParentTypeMungers(
            at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(
            at org.aspectj.weaver.bcel.BcelWeaver.weave(
            at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.weaveQueuedEntries(
            at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.queueForWeaving(
            at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.afterProcessing(
            at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$after$org_aspectj_ajdt_internal_compiler_CompilerAdapter$5$6b855184(CompilerAdapter.aj:98)

  • #2

    Do you know which version of AspectJ you are using?

    If you are on 1.6.10 you can set a system property to reduce memory usage (at the cost of performance).


    This parameter is a work in progress - which is why it isn't the default behaviour yet. That may help. I'm not sure how to increase the memory available to that process that is spawned whilst running under STS (unless it gets a launch configuration, in which case you can edit it, of course).

    Andy Clement


    • #3
      Thanks Andy, very helpful.

      I added the option as per instructions at and can now compile in STS.