Error "OCI-04030: out of process memory when trying to allocate" Occurs when De-Qeueing Messages from AQ JMS. (Doc ID 807785.1)

Last updated on JUNE 02, 2017

Applies to:

JDBC - Version and later
Information in this document applies to any platform.
***Checked for relevance on 31-Jan-2013***


-- Problem Statement:
On in Production:
There is a Java application that uses an AQ JMS connection using OCI to dequeue messages from a transactional queue containing AdtMessages with an XMLType payload (which is an LCR).

The connection method works like this:
AQjmsFactory -> TopicConnectionFactory -> TopicConnection -> TopicSession -> Topic
-> TopicReceiver

The application dequeues the messages in sets comprised of transactions. The string value of each
XMLType is extracted, so the transaction is eventually represented as a Java List of Strings (the
references to the AdtMessage and XMLType objects are released). Each transaction is processed
individually (sent to another machine), committed, and released. All transactions in the queue
are processed until the queue is empty, when the connection to the queue is closed. The
application polls the queue every thirty seconds, creating a new connection each time.

This application has been tested on many different machines, and works successfully for days at a
time. Occasionally, the application malfunctions when it appears to retrieve a truncated XML
string message. This appears to be caused by the OCI driver as it runs out of memory. Instead of
returning an error or exception, it returns a truncated message. The following error message is

Errors in file :
OCI-21503: program terminated by fatal error
OCI-04030: out of process memory when trying to allocate 78016 bytes
(qmxCreateOCISt,qmemNextBuf:Large Alloc)

Subsequent Java memory allocation causes the VM to generate a Hotspot error report for an
OutOfMemoryError and die (the OutOfMemoryError is not delivered to the application).

This does not seem to be a gradual memory leak. There is no process size increasing
gradually over the span of many days. The problem does not appear to be related to the number of
connections created, or the number of transactions or messages dequeued. When the application is
restarted, the transaction messages are dequeued without any problem (in the latest occurrence,
the transaction consisted of only 2 messages).

OCI-21503: program terminated by fatal error
OCI-04030: out of process memory when trying to allocate 78016 bytes (qmxCreateOCISt,qmemNextBuf:Large Alloc)

And the error in the dump file generated by the hotspot is as follows:

# An unexpected error has been detected by Java Runtime Environment:
# java.lang.OutOfMemoryError: requested 6000 bytes for char in
/BUILD_AREA/jdk6_10/hotspot/src/share/vm/utilities/hashtable.cpp. Out of swap space?
# Internal Error (allocation.inline.hpp:42), pid=22261, tid=4158852000
# Error: char in /BUILD_AREA/jdk6_10/hotspot/src/share/vm/utilities/hashtable.cpp
# Java VM: Java HotSpot(TM) Server VM (11.0-b15 mixed mode linux-x86)
# If you would like to submit a bug report, please visit:


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms