Fixing ‘Could not reserve enough space for object heap’ With Ant tool

December 6, 2011 | Error

Heap space error

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

This happens only because there is no enough space for ANT build tool to run the scripts. So first fix the heap space.

set ANT_OPTS = -Xms16m -Xmx512m

Add environment variable ANT_OPTS with value -Xms16m -Xmx512m

Even your application is huge, and even with very large scripts and heavy plugins, 512 MB of maximum heap space will suffice.

If the problem is still persists please check your ANT script whether anywhere the heap space is replacing by script commands like “set ANT_OPTS = -Xms16m -Xmx2048m

Tags: ,

Comments (4)

  1. Enjoyed examining this, very good stuff, thanks . “A man may learn wisdom even from a foe.” by Aristophanes.

  2. This is great, thanks a lot!

  3. I want to to thank you for this very good read!! I certainly loved every little bit
    of it. I have you bookmarked to check out new stuff you post…

  4. Skye says:

    Great article! We are linking to this great article on our website.
    Keep up the great writing.

Leave a Reply

If you have a Tip, Comment, Article or anything you want to share, please send it to: