0

I suspect when I call cudaMallocHost() that the memory is not freed by the kernel once the program quits.

While my program was running this was the used memory displayed by top: enter image description here

When the program ends then the used memory looks like this [updated due a comment]: enter image description here

There is nothing else running on the SLES 11 SP3 but there are still 6 GB used. I suspect that it may be because I do not explicitly release the memory I allocated previously by cudaMallocHost()?

What can it be?

Peter VARGA
  • 4,780
  • 3
  • 39
  • 75
  • I don't understand your question. Your top output shows your system *gaining* 4954Mb of free memory. What makes you think memory wasn't freed? What does the "buffers" and "cached" part of the top output you haven't shown us say? – talonmies Dec 19 '15 at 14:57
  • 1
    The linux OS, at termination of a user process, [should release all memory that was allocated by that process](http://www.informit.com/articles/article.aspx?p=370047&seqNum=4), including memory that was allocated by `mmap`, [which is the underlying OS call](http://stackoverflow.com/questions/26888890/cuda-and-pinned-page-locked-memory-not-page-locked-at-all/26890781#26890781) that supports `cudaHostAlloc` (there is no `cudaAllocHost`). – Robert Crovella Dec 19 '15 at 18:18
  • @RobertCrovella: Thank you for the hint. I apologize for the typo. It is fixed now. I meant `cudaMallocHost()` – Peter VARGA Dec 19 '15 at 21:54
  • 1
    This is just you misunderstanding what top is telling you regarding memory usage. The kernel is using about 5.4Gb in caching and buffering (which is perfectly normal) after your app is run. – talonmies Dec 19 '15 at 22:03

0 Answers0