Allocate named memory
Memory-Allocation Task | DataBlade API Function |
---|---|
To allocate named memory with a specified memory duration | mi_named_alloc() |
To allocate named memory with a specified memory duration that is initialized with zeros | mi_named_zalloc() |
If the allocation of the named-memory block is successful, these functions store a pointer to the allocated block in their mem_ptr argument. The UDR that allocated the named-memory block can access this named memory through this address. However, this address is deallocated when the routine invocation completes. Other UDRs must use the block name to access the named-memory block. For more information, see Obtain a block of allocated named memory.
These DataBlade API memory-management functions work correctly with the transaction management and memory reclamation of the database server. They provide the same advantages as the user-memory-management functions (see Allocate user memory (Server)). In addition, they provide the advantage that the named-memory block can be accessed by a name, which facilitates access to the memory across UDRs.