Memory Allocation Failure

Purpose of Document

This document provides an analysis of common common causes of Memory Allocation errors in batch applications.

Table of Content

Overview

MEMORY ALLOCATION FAILURE message occurs when memory cannot be allocated when needed.

Below are different scenarios where the error is seen.

Example 1: CMRB000007 - ERROR: Memory allocation failed

MEMORY ALLOCATION FAILURE
File: \builds\8.98.03.01.01\Rels\common\Jdekrnl\jdecache\jdecm_rb.c Line:251 iParam: 0000000404
3096/632 WRK:Starting jdeCallObject Wed Sep 08 09:41:12.013000 jdecm_rb.c2521
CMRB000007 - ERROR: Memory allocation failed

Example 2: CAC0000018 - Failed to allocate memory for stored key

MEMORY ALLOCATION FAILURE
File: \builds\_activebuild\common\Jdekrnl\jdecache\Jdecm.c Line:74 iParam: -0000130744
8632/10908 WRK:Starting jdeCallObject Tue Mar 27 15:06:27.671005 Jdecm.c752
CAC0000018 - Failed to allocate memory for stored key

Example 3: Not enough storage is available to process this command

Memory error: Allocation failure : Not enough storage is available to process this command. .
The operation has been cancelled.

Example 4: SQL0000047 - Allocation failed

MEMORY ALLOCATION FAILURE
File: \b9\common\jdbdrv\dbsql\dbsql_x.c Line:26 iParam: 0000008212
4168/4208 WRK:Starting jdeCallObject Wed Apr 25 13:21:48.241000 dbsql_x.c270
SQL0000047 - Allocation failed

4168/4208 WRK:Starting jdeCallObject Wed Apr 25 13:21:48.241002 dbsql_s.c1085
SQL0000039 - Allocation failed

Example 5: OCI0000020 - Out of memory for allocating return values

MEMORY ALLOCATION FAILURE
File: b3400500.c Line:625 iParam: 0000005050

MEMORY ALLOCATION FAILURE
File: b3400500.c Line:626 iParam: 0000005050

MEMORY ALLOCATION FAILURE
File: ../oracle/dbbndout.c Line:81 iParam: 0000008568
3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.203515 dbbndout.c821
OCI0000020 - Out of memory for allocating return values

3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.203736 dbbndout.c827
OCI0000021 - Error - DBOCI: insufficient memory to process request

3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.203887 dbinitrq.c885
OCI0000139 - Failed to bind input values - INSERT INTO PRODDTA.F3413 (MRITM, MRMCU, MRQT, MRSTRT, MRTRQT) VALUES (:BND1,:BND2,:BND3,:BND4,:BND5)

3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.204088 dbinitrq.c892
OCI0000140 - Error - ORA-00000: normal, successful completion

(continue ...)

MEMORY ALLOCATION FAILURE
File: jdecm_rb.c Line:250 iParam: 0000004014
3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.354208 jdecm_rb.c2515
CMRB000008 - ERROR: Memory allocation failed

MEMORY ALLOCATION FAILURE
File: ../dbsql/dbsql_x.c Line:26 iParam: 0000004108
3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.355409 dbsql_x.c270
SQL0000047 - Allocation failed

3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.355541 dbsql_d.c78
SQL0000013 - Allocation failed

3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.355670 dbinitrq.c593
OCI0000131 - Failed to generate SQL statement

3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.355816 dbinitrq.c599
OCI0000132 - Error - DBOCI: error in SQL generator

3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.355953 jdb_drvm.c893
JDB9900168 - Failed to initialize db request

3605/1 WRK:Starting jdeCallObject Sun Jul 26 00:48:17.356098 jdb_exet.c4666
JDB3500011 - Failed to delete for F3412


Note: This document does not cover memory allocation failure in your database server

Analysis

There are a few known causes to the error MEMORY ALLOCATION FAILURE. The most common are:

In general, based on cause of issue:

Possible ways to debug:

Back To Top

Common Questions on Insufficient Memory Issues

Q1. What are commonly reported UBEs that may produce the MEMORY ALLOCATION FAILURE issue?

Most commonly the issue is coming when the source data is huge or when a certain routine uses huge amount of cache to hold information before print out or commit it to a certain table. Mostly issue may come report:

Back To Top

Q2. What is maximum size of memory can be allocated per process/kernel?

It is varies depending on the enterprise server platform, hardware configuration and operating system. You may contact your vendor to find out more.

Back To Top

Q3. How Does EnterpriseOne manage Memory?

Each memory space is sized exactly based on the data in tables. For example, a tree node is needed for each record for each index in each table. Plus an extra NIL node is needed for each table to indicate tree leaves for the table indices. So we multiply the number of records by the number of indices plus 1 for each table and add them all up to create the exact number of tree nodes needed to load the cache. This means if somebody adds a record to a table and reloads the cache we do not have enough memory to hold all records. In this situation, we create an extra memory space for the needed type whenever we run out of memory. However, if records are deleted, we do not get rid of memory and shrink the size of the cache.

Note: A red-black tree is a type of self-balancing binary search tree, a data structure used in computing science, typically used to implement associative arrays.

Back To Top

Q4. How to estimate the memory size needed?

This calculation assumes the keys and indices to a certain table is left unchanged. If keys or indices are changed, the cache should still work, however the following calculation will be off. Approximately 193K will be used by the cache that is non-data related. Plus, the size of memory will be equivalent to the size of data in a certain table. In Unicode and 2 bytes Asian language, it requires two bytes per character. That is why, the usage of memory in Unicode environment will be higher than single byte environment.

Computation of size in byte:

Data Type Size in DD Actual Size in Byte
Character 1 2
String The size of DD + 1 (='\0') Size in DD x 2
Math Numeric Various 49
Integer 11 4
Pointer (GENLNG) 11 4
Date 6 6
JDEUTIME 11 16

For example, F4101 (Item Master) contains 10,000 rows the memory required will be:

Total Memory = [193,000 + {4,071 * 10,000 (rows)}] = (about) 40,903,000 = (about) 41MB
Notes:

Back To Top

Q5. What is the best way to work around this type of error?

This has to be approached from the application point of view or your business logic to cope with technical limitation.

Notes:

Back To Top

Q6. Are there some example of changing physical memory size?

Below is example which may (not) have fixed issue. Be consulted system administrator in your own organization and let them to adjust it if needed.

Set Large Physical Memory on Unix as below

Another example can be found at <Bug 10923195> reads, run below commands to increase memory space:

NOTES:

Back To Top

Q7. Is there way not to dump memory diagnostic in dmp file when jdemem code log Memory Allocation Failure?

From Tools Release 9.1.2.0 onwards "DmpMemDiagForMAF" under [DEBUG] section in enterprise server JDE.INI which will disable out of memory flag when set to 0 and will not dump memory diagnostic in dmp file when jdemem code log Memory Allocation Failure. This parameter has been implemented through <Bug 13715335> : NO CONFIGURATION SETTING TO DISABLE DMP FILE CREATION FOR OUT OF MEMORY.

Back To Top