Add utility method to DenseMap to return the amount of memory used for its buckets.
[oota-llvm.git] / include / llvm / ADT / DenseMap.h
index 332841f83e4d090f2de40a8716c172e072689a42..8b2dbac9c04753888e35a64ef96316a4b265c951 100644 (file)
@@ -466,6 +466,15 @@ private:
 
     NumEntries = 0;
   }
+  
+public:
+  /// Return the approximate size (in bytes) of the actual map.
+  /// This is just the raw memory used by DenseMap.
+  /// If entries are pointers to objects, the size of the referenced objects
+  /// are not included.
+  size_t getMemorySize() const {
+    return NumBuckets * sizeof(BucketT);
+  }
 };
 
 template<typename KeyT, typename ValueT,