# java.lang.OutOfMemoryError: Java heap space

**URL:** https://community.wowza.com/t/java-lang-outofmemoryerror-java-heap-space/35432
**Category:** Wowza Streaming Engine
**Tags:** server-administration
**Created:** [June 27, 2012, 4:55pm UTC](https://community.wowza.com/t/java-lang-outofmemoryerror-java-heap-space/35432 "2012-06-27T16:55:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel\_Mahoney](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@Daniel\_Mahoney](https://community.wowza.com/u/Daniel_Mahoney)
#### Post date: [June 27, 2012, 4:55pm UTC](https://community.wowza.com/t/java-lang-outofmemoryerror-java-heap-space/35432/1 "2012-06-27T16:55:31Z")

</div>

This bug has bitten me twice in the last month. Any idea what could be causing this? Wowza Media Server 3.0.3.08 build959 on EC2, Amazon Linux AMI release 2011.09, small instance.

2012-06-23 01:36:31 UTC - - - - - - - - - 2.292 - - - - - - - - - - - - - - - - - - - - - - - - -java.lang.OutOfMemoryError: Java heap space

at java.nio.HeapByteBuffer.(HeapByteBuffer.java:57)

at java.nio.ByteBuffer.allocate(ByteBuffer.java:329)

at org.apache.mina.common.SimpleByteBufferAllocator.allocate(Unknown Source)

at org.apache.mina.common.ByteBuffer.allocate(Unknown Source)

at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(Unknown Source)

at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(Unknown Source)

at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$600(Unknown Source)

at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(Unknown Source)

at org.apache.mina.util.NamePreservingRunnable.run(Unknown Source)

at java.lang.Thread.run(Thread.java:636)

My setenv.sh contains:

\_EXECJAVA=java

JAVA\_OPTS="-Xmx1000M -server"

WMSAPP\_HOME=/usr/local/WowzaMediaServer

WMSCONFIG\_HOME=/usr/local/WowzaMediaServer

WMSCONFIG\_URL=

VARJAVAMAXHEAPSIZE=1000M

GCOPTIONS="-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewSize=128m -verbose:gc -Xloggc:"/usr/local/WowzaMediaServer/logs/gc.log" -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC"

export WMSAPP\_HOME WMSCONFIG\_HOME JAVA\_OPTS \_EXECJAVA GCOPTIONS VARJAVAMAXHEAPSIZE

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [June 28, 2012, 2:40pm UTC](https://community.wowza.com/t/java-lang-outofmemoryerror-java-heap-space/35432/2 "2012-06-28T14:40:48Z")

</div>

Are setting java heap size to 1000m because you have limited ram and/or a 32bit system? That is not very high for a production server. I suggest getting a 64bit server with 4 - 8 gigs of ram, then setting java heap size accordingly.

Also, as noted in the tuning guide, avoid these custom GC options by default. Review step #6 in the tuning guide.

Richard
