I'm declaring a simple object of type StackElement. But, when I use the memory leak detection provided with Visual Studio 2008, it detects memory leaks. Can anyone please guide why this is happening ?
Detected memory leaks!
Dumping objects ->
{121} normal block at 0x0093AA98, 248 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
{120} normal block at 0x0093A918, 320 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
Object dump complete.
is _CrtDumpMemoryLeaks() the software you use to detect memory leaks (i dont use vs so i wouldnt know)? if it is, could it be because it is called before vStackElement goes out of scope, where the memory is freed?
Yes DTSCode. VS already has this library. I am not sure if that would be the case. Because, they asked us in their documentation to use _CrtDumpMemoryLeaks() at the exit point of the application. If my definition of "exit point of the application" is correct, this is what they want us to do.
Following is the documentation that I used for the VS Memory Leak detector. It says
After you have enabled the debug heap functions by using these statements, you can place a call to _CrtDumpMemoryLeaks before an application exit point to display a memory-leak report when your application exits: