Skip to content

Instantly share code, notes, and snippets.

@Amokrane
Created January 31, 2012 22:15
Show Gist options
  • Save Amokrane/1713395 to your computer and use it in GitHub Desktop.
Save Amokrane/1713395 to your computer and use it in GitHub Desktop.
Allocation Tracking
// Limit allocations to find problems
int prevLimit = -1;
try {
prevLimit = Debug.setAllocationLimit(0);
// Do stuff
} finally {
Debug.setAllocationLimit(-1);
}
// Count the allocations being made
Debug.startAllocationCounting();
// do stuff
int allocCount = Debug.getThreadAllocCount();
Debug.stopAllocationCounting();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment