Created
January 31, 2012 22:15
-
-
Save Amokrane/1713395 to your computer and use it in GitHub Desktop.
Allocation Tracking
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
// 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