Wednesday, July 1, 2009

"Cannot allocate memory" while compiling project with maven

While compiling my project with Maven I got sometimes on my Linux (Gentoo actually) box the following error
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error reading assembly descriptors: Error reading descriptor at: /var/www/app_src/src/main/assembly/package.xml: Cannot run program "env": java.io.IOException: error=12, Cannot allocate memory

This was caused by not enough amount of swap memory on linux. After increasing to double size of physical memory all problems are gone.

I was inspired by this entry of Hudson Wiki.