Skip to content

Commit

Permalink
8319314: NMT detail report slow or hangs for large number of mappings
Browse files Browse the repository at this point in the history
Reviewed-by: jsjolen, gziemski
  • Loading branch information
tstuefe committed Nov 11, 2023
1 parent c9077b8 commit 9938b3f
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/hotspot/share/nmt/memBaseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,25 @@ class MallocAllocationSiteWalker : public MallocSiteWalker {
}
};

// Compare virtual memory region's base address
int compare_virtual_memory_base(const ReservedMemoryRegion& r1, const ReservedMemoryRegion& r2) {
return r1.compare(r2);
}

// Walk all virtual memory regions for baselining
class VirtualMemoryAllocationWalker : public VirtualMemoryWalker {
private:
SortedLinkedList<ReservedMemoryRegion, compare_virtual_memory_base>
_virtual_memory_regions;
size_t _count;

typedef LinkedListImpl<ReservedMemoryRegion, AnyObj::C_HEAP, mtNMT,
AllocFailStrategy::RETURN_NULL> EntryList;
EntryList _virtual_memory_regions;
size_t _count;
DEBUG_ONLY(address _last_base;)
public:
VirtualMemoryAllocationWalker() : _count(0) { }
VirtualMemoryAllocationWalker() :
_count(0)
#ifdef ASSERT
, _last_base(nullptr)
#endif
{}

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 ++;
Expand Down

0 comments on commit 9938b3f

Please sign in to comment.