Java error from heap space

I am running a very lengthy process through an Ant script, I made the following heap, but still gave me an error.

set ANT_OPTS=-Xms1024M -Xmx2024M -XX:MaxPermSize=512M 
+2
source share
3 answers

It seems strange to me that you use more than 2G to complete the build (although this is obviously possible), so I will make some silly questions to help you think about your problem:

  • Are you sure that ANT_OPTS is set correctly?
  • Do you run the script from the command line or from the IDE?
  • What OS are you using?
  • How much physical memory do you have in the box?
  • Do you use any plugin or tool called by assembly?
  • Do you run the test during build? Do you deploy during tests?
+1
source

This means that your code is really trying to use more than 2 GB of memory. Use jprofiler, or yourkit, or the built-in JVM tools to figure out what it does and reduce memory usage.

Also, if on a 32-bit machine you cannot get full 2G.

0
source

You can also turn on garbage collection logging (details here ) and see why your Heappace is growing so much. It could be a memory leak. Of course, JProfiler will also allow you to do the same. Eclipse 3.4 and above have a profiler into which you can connect to the JVM where your program works if you do not want to use JProfiler.

0
source

All Articles