CUDA on a MacBook Pro 9400M

Hi,

I came into a problem with a MacBook Pro with an NVIDIA 9400M card.

Specifically I have developed this routine in an application :

size_t GetGPUmemory(){

      size_t memfree, memtot;

      cudaError_t error = cudaMemGetInfo(&memfree, &memtot);

      if (error != cudaSuccess) 

             return 0

      return memfree;

}

Without checking the MacBook goes 0-5MB and sometimes to 2GBs (it has only 256MB VRAM).

So by putting the cudaSuccess it stays stable at 0M. I am wondering if anyone knows if setting to zero when cuda fails to retreive memory is correct. Also what happens and cuda does not succeed?

Cheers,

Alexander.