Detecting memory leak in complicating source code

Hello everyone,

I'am trying to run a code which performs continuously min-cuts to a graph until it detects dense subgraphs.
Unfortunately, it seems that there is a memory leak and the program exits. As the program is constituted of many files, it is really difficult to detect the memory leak error.
I was wondering if there is a way to print the size of the allocated memory after each min-cut in order to test my code and find the memory leak.

Thank you!!
There isn't a standard way of debugging heap errors. Most techniques are compiler or operating system specific.

You could overload new/delete with your own versions that record that information to a file or stdout, then call the default new/delete.

What compliler/operating system are you using?
read about
_CrtDumpMemoryLeaks()
if you are visual studio.
I checked _CrtDumpMemoryLeaks() .
I think that unfortunately this method can not help.
the thing is that me program allocates memory that would free at the end of its execution.
But it never reaches that end.
It could be possibly due to enormous allocation of memory but i think tha this is not the case.
I have found that algorithm implemented with memory leaks but it was able to complete its execution and my work was to try erase those leaks.
use this function at the end of your code.
secondly, if you read about this then you will know some more details. there are some macros also.
if Microsoft has designed some function to find memory leaks then it will not be a useless function. correct??

otherwise design your own memory leak detector..!!!
its very easy to implement..only a 100 lines of code will do .. :)
Topic archived. No new replies allowed.