cudaMalloc and cudaHostAlloc size


Is there an equivalent to malloc_usable_size for cudaMalloc and cudaHostAlloc functions?

From Reference Manual:
“Allocates size bytes of linear memory on the device and returns in ∗devPtr a pointer to the allocated memory.
The allocated memory is suitably aligned for any kind of variable. The memory is not cleared.”

I would like to know exactly how much memory is allocated.

You could call cudaMemGetInfo() before and after cudaMalloc() to determine how much device memory is actually used. For cudaHostAlloc(), I’m not sure what you can do since other programs are likely to be allocating and deallocating host memory while your program runs.