Bloomberg LP Interview Question
Financial Software DevelopersI partially agree with abhi...
memory may or may not be same after app completes.
But if the memory leak is high..then may be this procedure ll work out..
As per hmm application crashes...
But i dont think application ll crash easily if memory leak is very little & i ve a huge chuck of memory.....
Coz we saw in our application some times our system crashes in the field after a week coz of memory leak...
So better to use valgrind / purify....
If an application terminates or crashes, all its allocated memory will be collected by the OS. Basically, OS will have the whole virtual page table that the application owned and, eventually release all the pages accordingly. So memory leak occurs only when the memory leaking program is still alive.
A memory leak is a particular type of memory consumption by a computer program where the program is unable to release memory it has acquired.
A memory leak can diminish the performance of the computer by reducing the amount of available memory. Eventually, in the worst case, too much of the available memory may become allocated and all or part of the system or device stops working correctly, the application fails, or the system slows down unacceptably due to thrashing.
There is a neat way to make sure there are no memory leak.
- TimeVision December 01, 2008http://www.flipcode.com/archives/How_To_Find_Memory_Leaks.shtml
Basically, you overload NEW and DELETE, so that every time NEW is called, you make a note of the variable name in your own allocation list. And every time DELETE is called, you remove the count. Therefore, at the end of the program, anything left in the list means a leak.