I am trying to correctly detect an out of memory condition in the GPU. However its seems that cudaMallocArray returns cudaSuccess (0) even if there is insufficient memory for the request.
I am using a trivial test program that loops allocating 49MB arrays until all 1024MB on my GPU is exhausted. I am using cuMemGetInfo to determine how much memory remains free. When it reaches 54MB, it doesn’t go down anymore. However cudaMallocArray continues to report success and return a pointer to the “allocated memory” which is not null.
When this happens in my “real” program, it goes on and copies data to the allocated array and gets an access violation - so I think the allocation really failed.
Is this a bug in cudaMallocArray? Or am I missing something?
Cuda 2.1, 32-bit application on XP64
GTX 280 card
Update: Changed to Quadro 5800 cards with 4GB of memory and driver V186.30. cudaMallocArray now reports error 2, which is a memory allocation error and returns a null pointer. Presumably the original behavior is a bug?