diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h index 332841f83e4..8b2dbac9c04 100644 --- a/include/llvm/ADT/DenseMap.h +++ b/include/llvm/ADT/DenseMap.h @@ -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