i have a appilcation consists of thousands lines of code. when i do some specific operation, i.e. open a very large document, the app almost eats up my memory. but after a while, the memory is given back. i have tested the codes and found no memory leak.
so, my problem is how to find the codes who eat up my memory.
any one can help me?
First, when you do a malloc or new, you extend the heap. For optimization reasons, the memory manager may not return the heap back to the OS immediately. When needing to allocate especially large chunks of memory, you can use a low level API directly or, with some compilers/CRTs, a different heap (for Windows, here's an article discussion various options: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366533%28v=vs.85%29.aspx[^].)
Also note that if you allocate memory and sit around, the OS may page it out. To understand the difference in Windows, look into "private bytes" and "working set".