Texture Object resource lifecycle

I initialize a cudaTextureObject_t using a cudaArray_t as a resource.

My question is, can we still use the texture object if the array is deleted? In other words, can the array be safely deleted after initialization of the texture object?

I am asking this question because I did not find an explicit answer. On one hand, the term “texture memory” seems to imply that texture data has to be transferred from global memory to somewhere else and therefore that the array is not needed after initialization. On the other hand, examples in the documentation such as the one from section 3.2.11.1.1 of the Programming guide frees the array after the texture object is destroyed.

No. The array backs the texture. Do not delete the array until you are done using the texture.