WebSphere out of memory error
<p>We use WebSphere application server for our application and we regularly get out of memory error. To debug this we added log to check used memory at certain places and below is the observation.</p>

<p>The used memory is not decreasing until it reaches threshold limit. We use below memory configuration:</p>

<pre><code>InitialHeapSize="1024" maximumHeapSize="2048"
</code></pre>

<p>So until it crosses 1024 the memory is not released. In the case of OOM error, the memory is not released only even though some threads are not in use. </p>

<p>I assumed that the heap size was not released. But the java Runtime API is displaying that there is memory available. Java operations like method class, string opertaions are working but its failing when JNDI look up is made with outofmemory exception. As a result, the system is failing because of unavilability of connection.</p>

<p>Stack trace:</p>

<p>com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is java.lang.OutOfMemoryError]
    at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1033)
    at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:730)</p>