Increasing Java Heap Size
While testing our modified algorithms on larger graphs, we ran into a Java heap size error. The heap size is the amount of memory allocated to the program being executed. Because our current implementation of the Louvain algorithm is in Java (more expensive than C++) and uses recursion, it is prone to running out of memory. Luckily, we are able to increase the max heap size via the -Xmx flag. Specifically, to see the current heap size of your system (on OS X):
java -XX:+PrintFlagsFinal -version | grep -iE ‘heapsize|permsize|threadstacksize’
To increase max heap size, add the flag -Xmx<size>; for example:
java -Xmx5000m myProgramName
The <size> is in bytes, but you can append k or K for kilobytes and m or M for megabytes. The default is 64MB.