Created
April 18, 2020 19:43
-
-
Save clwyatt/be574b0d920e25522b210591c17b978b to your computer and use it in GitHub Desktop.
Example of logging 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
#include <iostream> | |
int main(int argc, char *argv[]) | |
{ | |
int * ip = new int; | |
std::cout << "Allocated at " << (unsigned long)(ip) << "\n"; | |
// do something with object, e.g. | |
*ip = 4; | |
std::cout << "Deallocating " << (unsigned long)(ip) << "\n"; | |
delete ip; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment