Possible memory errors

Memory errors are usually caused by overrunning memory in a UDR.

To avoid common causes of memory errors in a UDR, make sure you meet the following memory-handling requirements.
Memory-handling requirement More information
Do not return the NULL-valued pointer from a UDR. Return a NULL value
Do not use null-terminated strings as data in a varying-length structure such as mi_lvarchar. Varying-length data and null termination
Do not return local variables from a UDR. Return a value
Make sure that you handle data types for parameters and return values with the correct passing mechanism. The MI_DATUM arguments and Return a value
Make sure memory that a UDR allocates is of the appropriate memory duration for its use. Do not access memory after its duration has expired. Choose the memory duration