diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-07-25 11:01:28 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2013-07-25 15:30:43 -0700 |
commit | 0a9dc05e704bfd033bac2aa38a4fc6f6b8e6cf93 (patch) | |
tree | ceee6b2676b4fbcee37d98bbb3b6e063bcbdd9b2 /runtime/safe_map.h | |
parent | d792cc1569c3505d68352c11a72447419ee6eaaf (diff) | |
download | art-0a9dc05e704bfd033bac2aa38a4fc6f6b8e6cf93.zip art-0a9dc05e704bfd033bac2aa38a4fc6f6b8e6cf93.tar.gz art-0a9dc05e704bfd033bac2aa38a4fc6f6b8e6cf93.tar.bz2 |
GC data structures allocation tracking
Adds a new stl compatible allocator that is used in most GC data
structures. When the data structures allocate and free memory, it
lets the heap know of how much memory was allocated or freed. Using
this info, we dump the approximated stl data structures memory usage
when a sigquit occurs.
The allocation tracking can be disabled with a compile time boolean
flag to remove performance impact.
Change-Id: Idddb6713169e07be913bceeb50f305c8573e4392
Diffstat (limited to 'runtime/safe_map.h')
-rw-r--r-- | runtime/safe_map.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/safe_map.h b/runtime/safe_map.h index dcc172d..4b5202a 100644 --- a/runtime/safe_map.h +++ b/runtime/safe_map.h @@ -18,6 +18,7 @@ #define ART_RUNTIME_SAFE_MAP_H_ #include <map> +#include <memory> #include "base/logging.h" @@ -25,10 +26,11 @@ namespace art { // Equivalent to std::map, but without operator[] and its bug-prone semantics (in particular, // the implicit insertion of a default-constructed value on failed lookups). -template <typename K, typename V, typename Comparator = std::less<K> > +template <typename K, typename V, typename Comparator = std::less<K>, + typename Allocator = std::allocator<std::pair<const K, V> > > class SafeMap { private: - typedef SafeMap<K, V, Comparator> Self; + typedef SafeMap<K, V, Comparator, Allocator> Self; public: typedef typename ::std::map<K, V, Comparator>::iterator iterator; @@ -87,7 +89,7 @@ class SafeMap { } private: - ::std::map<K, V, Comparator> map_; + ::std::map<K, V, Comparator, Allocator> map_; }; template <typename K, typename V, typename Comparator> |