C2M1212 Message
A C2M1212 message indicates some type of memory problem which can lead to memory corruption and other issues. The memory corruption could occur within application code or operating system code. The message is only a diagnostic message, but can be an indicator of a real problem. The C2M1212 message might or might not be the source of other problems. Clean up the memory problem if possible.
When a C2M1212 message is generated, the hexadecimal value of the
pointer passed to the free()
function is included as part
of the message description. This hexadecimal value can provide clues
as to the origin of the problem. The malloc()
function
returns only pointers that end in hexadecimal 0. Any pointer that
does not end in hexadecimal 0 was either never set to point to storage
reserved by the malloc()
function or was modified since
it was set to point to storage reserved by the malloc()
function.
If the pointer ends in hexadecimal 0, then the cause of the C2M1212
message is uncertain, and the program code that calls free()
should
be examined.
- Memory is being freed which has not been allocated.
- Memory is being freed for a second time.
In some cases, a memory leak can cause the single-level store heap to become fragmented to the point that the heap control segment is full and deallocates fail. This problem is indicated by an MCH6906 message. In this case, the only solution is to debug the application and fix the memory leak.
- The pointer was never initialized and contains an unexpected value. The C2M1212 message dumps the hex value of the pointer.
- The pointer was not obtained from
malloc()
. Perhaps the pointer is a pointer to an automatic (local) variable or a static (global) variable and not a pointer to heap storage frommalloc()
. - The pointer was modified after it was returned from
malloc()
. For example, if the pointer returned frommalloc()
was incremented by some amount and then passed tofree()
, it would be invalid and a C2M1212 message is issued. - The pointer is being passed a second time to
free()
. Oncefree()
has been called with the pointer, the space pointed to by that pointer is deallocated and iffree()
is called again, a C2M1212 message is issued. - The heap structure maintained by the heap manager to track heap allocations has been corrupted. In this case, the pointer is a valid pointer but the heap manager cannot determine that and a C2M1212 message results. When the heap structure is corrupted, there is typically at least one C2M1211 message in the job log to indicate that heap corruption has occurred.
- If the debug memory manager is in use and the reason code on the C2M1212 message is X'8000000000', padding bytes were overwritten for the given allocation. Refer to Debug Memory Manager for more information.