Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualKhatharr

Posted 13 November 2012 - 04:28 PM

AKA, meaning "Also Known As", implies that "static" and "global" are the same. Your usage of "i.e.", which means "that is", says that all globals are class variables, which is also not true. You should use "e.g." meaning "for example".


First smirk of the day award goes to rip-off.

This is an interesting problem with static variables. Since you call CrtDumpMemoryLeaks() before main() exits, static variables which allocate memory (which get destructed after main() exits) will still show as memory leaks. To avoid this false positive, don't call CrtDumpMemoryLeaks() manually. The _CRTDBG_LEAK_CHECK_DF flag effectively adds the memory leak dump as an atexit() call, which happens at the very end of the program.


This. I was about to look up the function there because I suspected that this was the case.

Memory leak detectors work by reporting on anything that's still allocated when they are invoked (they hook the allocation and deallocation functions to keep track). So if you're calling the function prior to the end of the program then anything that's still allocated will be reported on.

I'd also recommend checking out VLD. Someone here suggested it to me and I tried it and love it. You can just double-click the message in the report to go straight to the leaky allocation in the code.

#3Khatharr

Posted 13 November 2012 - 04:27 PM

AKA, meaning "Also Known As", implies that "static" and "global" are the same. Your usage of "i.e.", which means "that is", says that all globals are class variables, which is also not true. You should use "e.g." meaning "for example".


First smirk of the day award goes to rip-off.

This is an interesting problem with static variables. Since you call CrtDumpMemoryLeaks() before main() exits, static variables which allocate memory (which get destructed after main() exits) will still show as memory leaks. To avoid this false positive, don't call CrtDumpMemoryLeaks() manually. The _CRTDBG_LEAK_CHECK_DF flag effectively adds the memory leak dump as an atexit() call, which happens at the very end of the program.


This. I was about to look up the function there because I suspected that this was the case.

Memory leak detectors work by reporting on anything that's still allocated when they are invoked (they hook the allocation and deallocation functions to keep track). So if you're calling the function prior to the end of the program then anything that's still allocated will be reported on.

I'd also recommend checking out VLD. Someone here suggested it to me and I tried it and love it.

#2Khatharr

Posted 13 November 2012 - 04:26 PM

AKA, meaning "Also Known As", implies that "static" and "global" are the same. Your usage of "i.e.", which means "that is", says that all globals are class variables, which is also not true. You should use "e.g." meaning "for example".


First smirk of the day award goes to rip-off.

This is an interesting problem with static variables. Since you call CrtDumpMemoryLeaks() before main() exits, static variables which allocate memory (which get destructed after main() exits) will still show as memory leaks. To avoid this false positive, don't call CrtDumpMemoryLeaks() manually. The _CRTDBG_LEAK_CHECK_DF flag effectively adds the memory leak dump as an atexit() call, which happens at the very end of the program.


This. I was about to look up the function there because I suspected that this was the case.

Memory leak detectors work by reporting on anything that's still allocated when they are invoked (they hook the allocation and deallocation functions to keep track). So if you're calling the function prior to the end of the program then anything that's still allocated will be reported on.

I'd also recommend checking out VLD. Someone here suggested it to me and I tried it and love it.

#1Khatharr

Posted 13 November 2012 - 04:23 PM

AKA, meaning "Also Known As", implies that "static" and "global" are the same. Your usage of "i.e.", which means "that is", says that all globals are class variables, which is also not true. You should use "e.g." meaning "for example".


First smirk of the day award goes to rip-off.

PARTNERS