Community
Participate
Working Groups
java.lang.OutOfMemoryError at org.aspectj.util.FileUtil.readAsByteArray(FileUtil.java:1181) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.copyResourcesFromFile(AjBuildManager.java:529) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.copyResourcesToDestination(AjBuildManager.java:466) at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:363) at org.aspectj.ajdt.internal.core.builde ... ob.run(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: OutOfMemoryError thrown: Java heap space AJDT version 2.0.2
This looks like an AJDT problem, so changing products. First, I would suggest starting Eclipse with more heap space and permgen size. Add this to your arguments when starting: -vmargs -Xmx768M -XX:PermSize=64M -XX:MaxPermSize=128M If that doesn't work, you can bump Xmx up to 1024. If you are still getting problems let me know and this may be a real bug.
I am already using 1024m in eclipse.ini: -startup plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519 -product org.eclipse.epp.package.java.product --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1024m
Now it would be helpful to know some more about the project you are working on. * How big is it? * How many aspects? * What kinds of pointcuts are you using? Do you have any pervasive ones (eg- execution(* *..*(..))? * What kind of export operation are you doing (eg- PDE export, export jar)? Any chance you send the project my way and I can try it out and see if I can reproduce locally?
I sent you the info to your e-mail. (In reply to comment #3) > Now it would be helpful to know some more about the project you are working on. > > * How big is it? > * How many aspects? > * What kinds of pointcuts are you using? Do you have any pervasive ones (eg- > execution(* *..*(..))? > * What kind of export operation are you doing (eg- PDE export, export jar)? > > Any chance you send the project my way and I can try it out and see if I can > reproduce locally?
I was not able to open the archive you sent me. Can you please re-send the archive using a standard zip or gzip format? Also, please only send the smallest project that reproduces the problem. If this is an aspectj problem, I will forward this bug to the aspectj team.
Happens with the new AJDT version as well (2.1.0).
There has been quite a bit of work recently related to reducing the memory being used by the weaver. If you want to try this out, you can with the latest snapshot of AJDT. See the last few comments of Bug 278496. If you set the following two system properties: aspectj.minimalModel=true aspectj.typeDemotion=true then the size of the weaver should decrease significantly over time. Please let me know if you try this out.
Should it be added to eclipse.ini ? (In reply to comment #7) > There has been quite a bit of work recently related to reducing the memory > being used by the weaver. If you want to try this out, you can with the > latest snapshot of AJDT. See the last few comments of Bug 278496. If you set > the following two system properties: > > aspectj.minimalModel=true > aspectj.typeDemotion=true > > then the size of the weaver should decrease significantly over time. Please > let me know if you try this out.
I added these lines to eclipse.ini : -Daspectj.minimalModel=true -Daspectj.typeDemotion=true Is this the correct way to turn on these system properties? (In reply to comment #8) > Should it be added to eclipse.ini ? > > (In reply to comment #7) > > There has been quite a bit of work recently related to reducing the memory > > being used by the weaver. If you want to try this out, you can with the > > latest snapshot of AJDT. See the last few comments of Bug 278496. If you set > > the following two system properties: > > > > aspectj.minimalModel=true > > aspectj.typeDemotion=true > > > > then the size of the weaver should decrease significantly over time. Please > > let me know if you try this out.
(In reply to comment #9) > I added these lines to eclipse.ini : > -Daspectj.minimalModel=true > -Daspectj.typeDemotion=true > > Is this the correct way to turn on these system properties? Looks right to me. Any success?
No Should I see a log print about this somewhere? Where? (In reply to comment #10) > (In reply to comment #9) > > I added these lines to eclipse.ini : > > -Daspectj.minimalModel=true > > -Daspectj.typeDemotion=true > > > > Is this the correct way to turn on these system properties? > > Looks right to me. Any success?
Now that I think about it, these flags should be added to your build.properties file of the plugin(s) you are building. And the minimal model flag is not necessary when running ajc headless (as you do for pde export). In your build.properties, add the following two lines: compilerAdapter.useLog=true compilerArg=-vmargs -Daspectj.typeDemotion=true And after building, in the build directory, you can find a @dot.log file, which will contain information about type demotion. Actually, this file will only exist if you are doing your pde export from a headless mode, not if you are using an export wizard (in this case, Eclipse always cleans up all the build artifacts after the export). Sorry for the confusion on my part, but please tell me if this works for you.
And while you are fiddling with vmargs in the export, you may as well explicitly add a permsize and a max perm size. Something like: compilerArg=-vmargs -Xmx1024M -XX:PermSize=64M -XX:MaxPermSize=256M -Daspectj.typeDemotion=true
Sorry for the silly question, but where do I set these in Eclipse? (In reply to comment #13) > And while you are fiddling with vmargs in the export, you may as well > explicitly add a permsize and a max perm size. Something like: > > compilerArg=-vmargs -Xmx1024M -XX:PermSize=64M -XX:MaxPermSize=256M > -Daspectj.typeDemotion=true
Inside of your build.properties file inside of your plugin. Each plugin has a build.properties file that describes build information like source and bin directories, extra classpath entries, and compiler options.
I'm not sure what you refer to by 'plugin'. Is it the AJDT plug in? Or my project, which is not a plugin? where should the logfile be found? (In reply to comment #15) > Inside of your build.properties file inside of your plugin. Each plugin has a > build.properties file that describes build information like source and bin > directories, extra classpath entries, and compiler options.
Ugh...I'm mixing things up now. Apologies. You are not exporting a plugin, but exporting a regular AspectJ project as a jar file. Is that right? So, you can ignore what I said in the last few comments. Let me look at things a little bit more. I'll get back to you as to whether or not the particular system property is passed to the exporting call to ajc.
Were you able to find anything? (In reply to comment #17) > Ugh...I'm mixing things up now. Apologies. You are not exporting a plugin, > but exporting a regular AspectJ project as a jar file. Is that right? So, you > can ignore what I said in the last few comments. > > Let me look at things a little bit more. I'll get back to you as to whether or > not the particular system property is passed to the exporting call to ajc.
I am a bit surprised that you are not getting OOME when doing full builds, but you are when doing exports. The export operation simply performs an incremental build of your project, so it should have the same memory requirements as builds at any other time. Furthermore, the class files used for exporting are the class files in the output directory of your project. In fact, according to my testing, the AspectJ compiler is never actually called if your output directories are up to date (ie- the code involved in the stack trace that you include below should not be reached if your bin folders are up to date). My only suggestions to you are to keep using the minimalModel and typeDemotion system properties and also make sure that you have done a full build before running your export.
I am getting this errors with full builds. Actually on almost every full build I get it - I'm sorry I haven't been clear about this. How do I turn this properties on for a regular Eclipse AJDT project? (In reply to comment #19) > I am a bit surprised that you are not getting OOME when doing full builds, but > you are when doing exports. The export operation simply performs an > incremental build of your project, so it should have the same memory > requirements as builds at any other time. Furthermore, the class files used > for exporting are the class files in the output directory of your project. In > fact, according to my testing, the AspectJ compiler is never actually called if > your output directories are up to date (ie- the code involved in the stack > trace that you include below should not be reached if your bin folders are up > to date). > > My only suggestions to you are to keep using the minimalModel and typeDemotion > system properties and also make sure that you have done a full build before > running your export.
Are you on the latest dev build? After that, all you need to do is add the options to the eclipse.ini. You will know that this option is turned on if you see things like this in your system console: ASPECTJ: aspectj.typeDemotion=true: type demotion switched ON ASPECTJ: aspectj.minimalModel=true: minimal model switched ON If you are on windows, then you need to run eclipsec.exe. Also, using the -consoleLog argument is good regardless of your platform (add to eclipse.ini as well).
I do not see these debug prints in the console. I am using: Eclipse AspectJ Development Tools Version: 2.1.1.e36x-20100817-1900 AspectJ version: 1.6.10.20100817163700 this is my eclipse.ini: -startup plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1024m -Daspectj.minimalModel=true -Daspectj.typeDemotion=true -consoleLog (In reply to comment #21) > Are you on the latest dev build? After that, all you need to do is add the > options to the eclipse.ini. > > You will know that this option is turned on if you see things like this in your > system console: > > ASPECTJ: aspectj.typeDemotion=true: type demotion switched ON > ASPECTJ: aspectj.minimalModel=true: minimal model switched ON > > If you are on windows, then you need to run eclipsec.exe. Also, using the > -consoleLog argument is good regardless of your platform (add to eclipse.ini as > well).
Ok, now I see these debug prints. I still get the out of memory exception when building. I am using: Eclipse AspectJ Development Tools Version: 2.1.1.e36x-20100817-1900 AspectJ version: 1.6.10.20100817163700 this is my eclipse.ini: -startup plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1024m -Daspectj.minimalModel=true -Daspectj.typeDemotion=true -consoleLog (In reply to comment #21) > Are you on the latest dev build? After that, all you need to do is add the > options to the eclipse.ini. > > You will know that this option is turned on if you see things like this in your > system console: > > ASPECTJ: aspectj.typeDemotion=true: type demotion switched ON > ASPECTJ: aspectj.minimalModel=true: minimal model switched ON > > If you are on windows, then you need to run eclipsec.exe. Also, using the > -consoleLog argument is good regardless of your platform (add to eclipse.ini as > well). (In reply to comment #23) > I do not see these debug prints in the console. > I am using: > Eclipse AspectJ Development Tools > > Version: 2.1.1.e36x-20100817-1900 > AspectJ version: 1.6.10.20100817163700 > > this is my eclipse.ini: > -startup > plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar > --launcher.library > plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503 > -product > org.eclipse.epp.package.java.product > --launcher.defaultAction > openFile > --launcher.XXMaxPermSize > 256M > -showsplash > org.eclipse.platform > --launcher.XXMaxPermSize > 256m > --launcher.defaultAction > openFile > -vmargs > -Dosgi.requiredJavaVersion=1.5 > -Xms40m > -Xmx1024m > -Daspectj.minimalModel=true > -Daspectj.typeDemotion=true > -consoleLog > > (In reply to comment #21) > > Are you on the latest dev build? After that, all you need to do is add the > > options to the eclipse.ini. > > > > You will know that this option is turned on if you see things like this in your > > system console: > > > > ASPECTJ: aspectj.typeDemotion=true: type demotion switched ON > > ASPECTJ: aspectj.minimalModel=true: minimal model switched ON > > > > If you are on windows, then you need to run eclipsec.exe. Also, using the > > -consoleLog argument is good regardless of your platform (add to eclipse.ini as > > well). (In reply to comment #23) > I do not see these debug prints in the console. > I am using: > Eclipse AspectJ Development Tools > > Version: 2.1.1.e36x-20100817-1900 > AspectJ version: 1.6.10.20100817163700 > > this is my eclipse.ini: > -startup > plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar > --launcher.library > plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503 > -product > org.eclipse.epp.package.java.product > --launcher.defaultAction > openFile > --launcher.XXMaxPermSize > 256M > -showsplash > org.eclipse.platform > --launcher.XXMaxPermSize > 256m > --launcher.defaultAction > openFile > -vmargs > -Dosgi.requiredJavaVersion=1.5 > -Xms40m > -Xmx1024m > -Daspectj.minimalModel=true > -Daspectj.typeDemotion=true > -consoleLog > > (In reply to comment #21) > > Are you on the latest dev build? After that, all you need to do is add the > > options to the eclipse.ini. > > > > You will know that this option is turned on if you see things like this in your > > system console: > > > > ASPECTJ: aspectj.typeDemotion=true: type demotion switched ON > > ASPECTJ: aspectj.minimalModel=true: minimal model switched ON > > > > If you are on windows, then you need to run eclipsec.exe. Also, using the > > -consoleLog argument is good regardless of your platform (add to eclipse.ini as > > well).
In the workspace that you sent me, the PaperTests project uses the project root as a source folder, but has a separate destination folder. When I made the change, memory usage went down dramatically. What I think is happening is that the aspectj build is copying over all of the jars to the bin folder and this is causing an unnecessary spike in memory. I was never able to get close to an OOME, though. But this may fix things for you.
You were right. I closed this project and now I can build the much larger project with no problems. Very strange - is this something fixable?. Thanks!
> is this something fixable? As I mentioned, the best workaround is to move your source files into a source folder instead of the project root. But, there is definitely a memory issue with this when running as an AspectJ project. It is something I can look into. I'll resolve this bug and open a new one with a better description of what the real problem is.
Created Bug 323745
Is this the right bug #? (In reply to comment #28) > Created Bug 323745
(In reply to comment #29) > Is this the right bug #? Nope. :) Bug 323754