IBM Support

Approach for C2M1212 Messages Questions

Troubleshooting


Problem

The C runtime team made a change that enabled the C2M1212 message to be sent when the free() or realloc() functions were called using an invalid pointer.

Resolving The Problem

Background

In V5R1, the C runtime team made a change that enabled the C2M1212 message to be sent when the free() or realloc() functions were called using an invalid pointer. In prior releases, no message was sent, and no action was taken on the memory pointed to by the invalid pointer. It was deemed dangerous to hide the fact that an application is trying to free memory that has not allocated because the application could potentially free memory that belongs to another process. For this reason, the C2M1212 messages are now externalized.

Cases where the message could appear:

The C2M1212 message could appear whenever an application attempts to call the free() or realloc() functions. If the function determines that the pointer passed to it does not point to memory that was allocated with the malloc() function, it will return without freeing the memory at the pointer offset and send the C2M1212 message.

Getting rid of the messages:

The only way to prevent the messages from being sent is to fix the application code to properly manage its memory allocation. This can be done by carefully examining memory usage, and freeing only memory that is still allocated. Heavy handed tactics of calling free on any pointer that referenced allocated memory during the application lifetime will no longer work. Also, programmers should be aware of APIs that may modify pointers that are passed as arguments. Usage of the iconv() API is a good example of an API to check closely.

If users are having problems with C2M1212 messages, they should determine the vendor of the application that is encountering the message. The user should then contact the vendor with the message information, so that the vendor can determine where the invalid function call is being performed.

 Refer to this document for a deeper dive into diagnosing heap memory problems 
https://www.ibm.com/support/pages/diagnosing-and-debugging-heap-memory-problems-c2m1211-and-c2m1212-messages

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

26393531

Document Information

Modified date:
08 April 2025

UID

nas8N1017040