Posts Tagged ‘red5 startup’

Could not reserve enough space for object heap

Wednesday, November 18th, 2009

While restarting the red5 service on the server, If you get following error

——————BEGIN SESSION——————
root@server [~]# cd /usr/local/red5/dist
root@server [/usr/local/red5/dist]#./red5.sh &
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
===============================

Then the best solution for this error is to use the following command. This command will increase the java heap size.

Quote:
root@server [/]#export _JAVA_OPTIONS=”-Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled”

Be sure that it ends with a ” if it is missing add it manually. Then restart the red5

Quote:

root@server [~]# cd /usr/local/red5/dist
root@server [/usr/local/red5/dist]#./red5.sh &

If you are facing same problem “Error occurred during initialization of VM” again and again on the server then the problem is with the ulimit setting. If it is a cpanel/WHM server then add the following code in the start of the /etc/profile file.

Quote:
#cPanel Added Limit Protections — BEGIN

#unlimit so we can run the whoami
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null

LIMITUSER=$USER
if [ -e "/usr/bin/whoami" ]; then
LIMITUSER=`/usr/bin/whoami`
fi
if [ "$LIMITUSER" != "root" ]; then
ulimit -n 100 -u 20 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
else
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
fi
#cPanel Added Limit Protections — END

Save and exit.

Log out and login again (or start another session) for these changes to take effect.