foursquare/heapaudit — pull request #2 by chrisfesler (2012-02-09 01:22:21+00:00)
Title: Allow instrumentation of java.util, prevent recording of incidental allocations

Here are seven patches.

* The first two, you probably won't want: they add my tools.jar to the pom file and add my IDE files to the .gitignore.
* The next patch allows selective enabling of classes with more-specific patterns than those in HeapSettings.toAvoid. The idea is to allow auditing of common and expensive allocations by ArrayList, HashMap, etc.
* The next two patches fix infinite recursions resulting from instrumenting ArrayList and ConcurrentHashMap, both of which are used by heapaudit itself. I'm queasy about the second patch, which adds an additional thread-local counter to HeapUtil (similar to HeapUtil.recordings), specific to protecting the caching of sizes by type.
* Another patch prevents recording of all the Strings that are constructed in various record overrides, mostly as arguments to sizeOf().
* Finally, I turned on instrumentation of all java/util classes. This is probably overly-aggressive; I don't necessarily suggest taking this one. : )