clImportMemoryARM return CL_OUT_OF_HOST_MEMORY

The code is like this:


cl_mem buffer = clImportMemoryARM(context,
CL_MEM_READ_WRITE,
NULL,
ptr,
size,
&err);

if ptr is a newly malloc buffer pointer, like

char* ptr = (char*)malloc(size);
it works fine.
However, when passing into a third party library pointer (accessible from CPU), let's call it coolPtr, it will return error code -6, which is CL_OUT_OF_HOST_MEMORY
cl_mem buffer = clImportMemoryARM(context,
CL_MEM_READ_WRITE,
NULL,
coolPtr,
size,
&err);
I can do other operations with coolPtr successfully, like I can
memcpy(dstPtr, coolPtr, size);
Then why does the clImportMemoryARM fail for coolPtr? Thanks!
More questions in this forum