Malloc

Function Usage

Memory allocation function, which determines whether the memory is for a host, device, or DVPP by assigning a value to the type structure of MemoryData. size in MemoryData is used to specify the memory size. deviceid in MemoryData is used to specify the device memory ID. To destroy the allocated memory, use the Free function.

Prototype

static APP_ERROR Malloc(MemoryData& data);

Parameter Description

Parameter

Input/Output

Description

data

Input

Memory data to be allocated The input is the memory type and size, which are assigned to data.type and data.size respectively. The output is the allocated memory pointer, which is assigned to data.ptrData.

The value range of data.size is [1, 1073741824].

Return Parameter Description

Data Structure

Description

APP_ERROR

Error code returned during program execution. For details, see the MxBase/ErrorCode/ErrorCode.h file.