Memory durations for C UDRs
Because a C UDR executes in the memory space of the database server, its dynamic memory allocations can increase the memory usage of the database server. For this reason, it is very important that a UDR release its dynamically allocated memory as soon as it no longer needs to access this memory.
To help ensure that unneeded memory is freed, the database server associates a memory duration with memory allocation made from its shared memory. The database server automatically reclaims shared memory based on its memory duration.
- PER_STMT_EXEC
The PER_STMT_EXEC memory duration helps improve overall database server performance because it does not hold memory as long as the PER_STATEMENT duration.
- PER_STMT_PREP
Use the PER_STMT_PREP memory duration when you want memory to be held for the life of a prepared statement.
For more information about these memory durations and using onstat utility options to monitor memory usage of C UDRs, refer to the Informix® DataBlade® API Programmer's Guide.