Home | Previous Page | Next Page   Creating User-Defined Routines > Managing Memory >

Managing Shared Memory

The following kinds of C functions can make allocations from the database server shared memory:

The DataBlade API provides the memory-management functions in Table 98 for the dynamic allocation of database server shared memory.

Table 98. Memory-Management Functions of the DataBlade API
Type of Shared
Memory
Description DataBlade API Functions
User memory Memory that is accessible by its address only. User memory can be allocated in the current memory duration or have a specified memory duration. mi_alloc( ), mi_dalloc( ), mi_realloc( ), mi_zalloc( ), mi_switch_mem_duration( ), mi_free( )
Named memory Memory that has a name assigned and is accessible by its address or its name. Named memory has a specified memory duration. mi_named_alloc( ), mi_named_zalloc( ), mi_named_get( ), mi_named_free( )

mi_lock_memory( ), mi_try_lock_memory( ), mi_unlock_memory( )

Important:
Named memory is an advanced feature that can adversely affect your UDR if you use it incorrectly. Use it only when no regular DataBlade API feature can perform the task you need done.

Tip:
A client LIBMI application can also use DataBlade API memory-management functions to perform dynamic allocations. However, these memory-management functions allocate memory from the client process, not from the shared memory of the database server. Therefore, memory that these functions allocate from within a client LIBMI application does not have a memory duration associated with it. For more information, see Managing Memory in Client LIBMI Applications.

These DataBlade API memory-management functions in Table 98 work correctly with the transaction management and memory reclamation of the database server. In particular, they provide the following advantages:

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]