cufftPlan1d memory usage

I’m facing cudafft failure when I reach a cufftPlan1d call with low memory. In that case I have 2048² images (16MB): memory allocation for the image and its transform runs fine. But the transform operation fails when I have less than 32MB available.

This leads to another question: I keep this 32MB margin when I compute how much thing I can allocate. This 32 value is quite random: I ran some tests but I don’t know why I can’t just trust the cuMemGetInfo() value.