Cuda application uses too much host memory

Hi

I’m building an application where my CUDA program creates the cudaContext(using cudaFree(0)) waits for a file inside a folder , and when the file is created run the kernels and produce the output, and wait for the next file. I have it working but the problem is that the memory usage of the program is ridiculous. The amount of memory that it uses is for every file is about 112MB. So the amount of host memory it uses gets big really quickly. I’ve checked all my code for possible memory leaks and I couldn’t find them the only thing that I can think of is the cudaContext creates these memory locations every time the kernel runs and never lets them go. Is that a fair assumption? If so how can I fix this problem?

Hi, That sounds almost like a textbook definition of a memory leak. I would focus your efforts on making sure for each ‘malloc’ you have a ‘free’ as it is highly probable there is something there. Unfortunately without your host code it is hard to debug for you, but one way I try to narrow down things like that is to comment out the guts of the code, and slowly re-add it until the bug re-appears.

Tiomat