mstxMemRegionsRegister

Function Description

Registers secondary allocation of a memory pool. Ensure that the memory of RegionsRegister is within the range registered by mstxMemHeapRegister. Otherwise, the tool displays a message indicating that out-of-bounds read/write occurs.

Function Prototype

void mstxMemRegionsRegister(mstxDomainHandle_t domain, mstxMemRegionsRegisterBatch_t const *desc)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

domain

Input

globalDomain or the handle returned by mstxDomainCreateA.

Data type: const char *

desc

Input

Description of the memory area for secondary allocation in the memory pool. The value cannot be empty.

struct mstxMemRegion_st;
typedef struct mstxMemRegion_st mstxMemRegion_t;
typedef mstxMemRegion_t* mstxMemRegionHandle_t;

typedef struct mstxMemRegionsRegisterBatch_t {
    mstxMemHeapHandle_t heap;  // Handle to the memory pool for secondary allocation
    mstxMemType regionType;  // Memory type of the memory region
    size_t regionCount;  // Number of memory regions
    void const *regionDescArray;  // Memory region description
    mstxMemRegionHandle_t* regionHandleArrayOut;  // Returned handle array obtained from the secondary allocation registration
} mstxMemRegionsRegisterBatch_t;

Returns

None

Calling Example

mstxMemRegionsRegisterBatch_t regionsDesc{};
regionsDesc.heap = memPool;
regionsDesc.regionType = MSTX_MEM_TYPE_VIRTUAL_ADDRESS;
regionsDesc.regionCount = 1;
regionsDesc.regionDescArray = rangesDesc;
regionsDesc.regionHandleArrayOut = regionHandles;
mstxMemRegionsRegister(globalDomain, regionsDesc);              // Register secondary allocation.