sanitizerRtMalloc

Function

Call aclrtMalloc to allocate linear memory of the size on the device, return the pointer of the allocated memory through *devPtr, and report the memory allocation information to the detection tool. The actual memory allocation behavior and parameter meanings are the same as those of aclrtMalloc.

For details about aclrtMalloc, see .

Prototype

aclError sanitizerRtMalloc(void **devPtr, size_t size, aclrtMemMallocPolicy policy, char const *filename, int lineno);

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

devPtr

Output

Pointer to the pointer to the allocated device memory.

size

Input

Allocated memory size, in bytes.

The size cannot be 0.

policy

Input

Memory allocation policy.

filename

Input

Name of the file where memory allocation is called.

lineno

Input

Number of the line where memory allocation is called.

Return

0 on success; else, failure.

Examples

For details, see Step 4.