Questions about cudaArray allocated with cudaMalloc3DArray

cudaMalloc3DArray() will allocate GPU memory for an array of type cudaArray.

  1. How can I release the memory of this array?

  2. After the array is bound to a texture, am I safe to release the memory of this array? In other words, are texture memory and this array the same thing?

  3. If I unbind the array from the texture, will the memory of the array be released as well?

  4. How can I directly access this array in a kernel? Is tex3D() the only way to read from this array?

  5. Any restrictions about the dimension of a texture array? For example, the minimum size in each dimension? Whether it has to be the power of 2?

Thank you very much!


The array is stored in device memory and where data is fetched from. Don’t free it until you are done with it.


tex3D is the only way

There is a maximum size to each dimension. See the programming guide for details.

Thanks for your reply. Very helpful information!

One more question:

How to free the memory allocated with cudaMalloc3D()? This function returns a cudaPitchedPtr. I used cudaFree(myPitchedPtr.ptr) for memory release, which didn’t report any error but I’m not sure its correctness.

Thanks again!