How to deal with cudaMallocPitch and thrust

I’m using thrust for RAII style memory management.

In an ideal world, I could figure out the allocation for pitched memory by calling cudaGetMallocPitch(&pitch,width,height), and then perform the allocation using thrust.

I can’t find an API that lets me do this.

How do you folks cope? I’m thinking of calling cudaMallocPitch to estimate the size and then de-allocating the array, although I suspect there is a special place in hell reserved for that implementation.