Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualmarius1930

Posted 31 March 2013 - 05:34 PM

#include <crtdbg.h>
 
First line of your main:
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
 
That should give you the allocation ID.
 
To set a breakpoint on the allocation ID either set a breakpoint on {,,msvcr100d.dll}_crtBreakAlloc   (the dll name here will change depending on your visual studio/etc)
The alternative is to call _CrtSetBreakAlloc(n); in your code.
 
 
If you want to go all the way and get file:line numbers on the leak, try:
#define new new( _NORMAL_BLOCK, __FILE__, __LINE__) 

 

 

 

Good luck! smile.png
(And if you happen to not be using MSVC, the leaks is the least of your problems)

 

Edit: Hint hint hint: Notice how your deconstructor is not virtual. Look it up! ;)


#1marius1930

Posted 31 March 2013 - 05:31 PM

#include <crtdbg.h>
 
First line of your main:
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
 
That should give you the allocation ID.
 
To set a breakpoint on the allocation ID either set a breakpoint on {,,msvcr100d.dll}_crtBreakAlloc   (the dll name here will change depending on your visual studio/etc)
The alternative is to call _CrtSetBreakAlloc(n); in your code.
 
 
If you want to go all the way and get file:line numbers on the leak, try:
#define new new( _NORMAL_BLOCK, __FILE__, __LINE__) 

 

 

 

Good luck! smile.png
(And if you happen to not be using MSVC, the leaks is the least of your problems)


PARTNERS