Skip to content

Instantly share code, notes, and snippets.

@clwyatt
Created April 18, 2020 19:43
Show Gist options
  • Save clwyatt/be574b0d920e25522b210591c17b978b to your computer and use it in GitHub Desktop.
Save clwyatt/be574b0d920e25522b210591c17b978b to your computer and use it in GitHub Desktop.
Example of logging allocations
#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