Detecting memory leaks

I’ve run my application through compute-sanitizer with memcheck tool with leak-check full option : zero errors are returned.

When I run with top, I see VIRT setting at 17GB, but RES setting starts at around 5 GB and rises continuously. Is this a cause for concern?

Edit: running for a longer period of time, the RES increase slows down considerably.

Compute sanitizer does only check for device memory leaks. For host memory, you need to use a different tool, for example valgrind.

The docs say that check for device memory must be explicitly enabled - so it also checks for leaks from cudaHostAlloc. I have used valgrind as well and it reports some cuda leaks, so if sanitizer says no leaks, I’m probably good.

to clarify, compute-sanitizer checks for leaks in memory allocated with the cuda api. that does not mean there are no leaks in general. (the top command obviously accounts for more than cuda api host allocations)

1 Like