Created
June 16, 2015 22:34
-
-
Save karimnaaji/e8ca6c52682594bb1212 to your computer and use it in GitHub Desktop.
track c++ allocations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global operator new | |
global operator new [] | |
global operator delete | |
global operator delete [] | |
#undef new | |
void *operator new (size_t size, char *file, int line, char *function); | |
// [...] | |
#define new new (__FILE__, __LINE__, __FUNCTION__) | |
// implementation | |
void *operator new (size_t size, char *file, int line, char *function) { | |
// tracking code | |
return malloc (size); | |
} | |
// [...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment