Advanced memory durations
The DataBlade API memory-management functions also support several advanced memory durations, which the following table shows.
Advanced memory duration | Memory-duration constant | Description |
---|---|---|
For the duration of the current transaction | PER_TRANSACTION | The database server frees the memory after the current transaction ends (commit or rollback). |
For the duration of the current session | PER_SESSION | The database server frees memory at the end of the current session. |
For the duration of the database server execution | PER_SYSTEM | The database server frees memory when it is brought down. |
Important: The memory durations in Table 1 are advanced and can adversely
affect your UDR if you use them incorrectly. Use them only when no
regular DataBlade
API memory
duration can perform the task you need.
As with the public memory-duration constants, the advanced memory-duration
constants in Table 1 are
of type MI_MEMORY_DURATION. However, these constants are declared
in the minmdur.h header file, not the memdur.h header
file. The minmmem.h header file automatically
includes the minmdur.h header file. The mi.h header
file, however, does not automatically include minmmem.h.
To access advanced memory durations, you must include minmmem.h in
any DataBlade
API routine
that uses these memory durations.
Important: Any memory
with a duration higher than PER_COMMAND can have multiple threads
access it. Therefore, consider whether you need to handle concurrency
issues for any PER_TRANSACTION, PER_SESSION, or PER_SYSTEM memory
you allocate. For more information, see Handling concurrency issues.