|Home > Optimizing OpenCL for Mali GPUs > Optimizing memory allocation > Sharing memory between I/O devices and OpenCL|
For an I/O device to share memory with OpenCL, you must allocate the memory in OpenCL with CL_MEM_ALLOC_HOST_PTR.
You must allocate the memory in OpenCL with
it ensures that the memory pages are always mapped into physical
If you allocate the memory on the application processor, the OS might not allocate physical memory to the pages until they are used for the first time. Errors occur if an I/O device attempts to use unmapped pages.