diff --git a/src/hotspot/share/nmt/memBaseline.cpp b/src/hotspot/share/nmt/memBaseline.cpp index 3363268ef9054..1e20bdfe9f685 100644 --- a/src/hotspot/share/nmt/memBaseline.cpp +++ b/src/hotspot/share/nmt/memBaseline.cpp @@ -82,14 +82,10 @@ int compare_virtual_memory_site(const VirtualMemoryAllocationSite& s1, class MallocAllocationSiteWalker : public MallocSiteWalker { private: SortedLinkedList _malloc_sites; - size_t _count; // Entries in MallocSiteTable with size = 0 and count = 0, // when the malloc site is not longer there. public: - MallocAllocationSiteWalker() : _count(0) { } - - inline size_t count() const { return _count; } LinkedList* malloc_sites() { return &_malloc_sites; @@ -98,7 +94,6 @@ class MallocAllocationSiteWalker : public MallocSiteWalker { bool do_malloc_site(const MallocSite* site) { if (site->size() > 0) { if (_malloc_sites.add(*site) != nullptr) { - _count++; return true; } else { return false; // OOM @@ -116,22 +111,17 @@ class VirtualMemoryAllocationWalker : public VirtualMemoryWalker { typedef LinkedListImpl EntryList; EntryList _virtual_memory_regions; - size_t _count; DEBUG_ONLY(address _last_base;) public: - VirtualMemoryAllocationWalker() : - _count(0) -#ifdef ASSERT - , _last_base(nullptr) -#endif - {} + VirtualMemoryAllocationWalker() { + DEBUG_ONLY(_last_base = nullptr); + } bool do_allocation_site(const ReservedMemoryRegion* rgn) { assert(rgn->base() >= _last_base, "region unordered?"); DEBUG_ONLY(_last_base = rgn->base()); if (rgn->size() > 0) { if (_virtual_memory_regions.add(*rgn) != nullptr) { - _count ++; return true; } else { return false;