cudaArray 3D

I want to call initTextureCuda a second time with a new ptrDataVoxel

I have to create a new cudaArray (3D)…right?

how do I free the memory? cudaFree or cudaFreeArray does not work

////////////////////////////////////////////////////////////////////////////////////////////////////////////

texture<TypePhantom, 3, cudaReadModeElementType> textureVoxelData;

void initTextureCuda(const TypePhantom *ptrDataVoxel,cudaArray *ptrCudaArray,cudaExtent voxelDataSize)
{

cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(16,0,0,0,cudaChannelFormatKindUnsigned); 	
 
cutilSafeCall( cudaMalloc3DArray(&ptrCudaArray, &channelDesc, voxelDataSize) );


cudaMemcpy3DParms copyParams = {0};
copyParams.srcPtr   = make_cudaPitchedPtr((void*)ptrDataVoxel,voxelDataSize.width*sizeof(TypePhantom),voxelDataSize.width,voxelDataSize.height);
copyParams.dstArray = ptrCudaArray;
copyParams.extent   = voxelDataSize;
copyParams.kind     = cudaMemcpyHostToDevice;
cutilSafeCall( cudaMemcpy3D(&copyParams) );


textureVoxelData.normalized = false;                      
textureVoxelData.filterMode = cudaFilterModePoint;      
textureVoxelData.addressMode[0] = cudaAddressModeWrap;   
textureVoxelData.addressMode[1] = cudaAddressModeWrap;
textureVoxelData.addressMode[2] = cudaAddressModeWrap;


cutilSafeCall(cudaBindTextureToArray(textureVoxelData, ptrCudaArray, channelDesc));	

}