|Home > Optimizing OpenCL for Mali GPUs > Optimizing memory allocation > Do not create buffers with CL_MEM_USE_HOST_PTR if possible|
When a memory buffer is created using
clCreateBuffer(CL_MEM_USE_HOST_PTR), the driver might be required to copy the data to a separate buffer. This copy enables a kernel running on the GPU to access it. If the kernel modifies the buffer and the application maps the buffer so that it can be read, the driver copies the updated data back to the original location. The driver uses the application processor to perform these copy operations, that are computationally expensive.
This method of allocating buffers is shown in the following figure.
If your application can use an alternative allocation type, it can avoid
these computationally expensive copy operations. For example,