// This class represents a snapshot of virtual memory at a given time. // The latest snapshot is saved in a static area. class VirtualMemorySnapshot : public ResourceObj {
friend class VirtualMemorySummary;
// Move virtual memory from one memory type to another. // Virtual memory can be reserved before it is associated with a memory type, and tagged // as 'unknown'. Once the memory is tagged, the virtual memory will be moved from 'unknown' // type to specified memory type. static inline void move_reserved_memory(MEMFLAGS from, MEMFLAGS to, size_t size) {
as_snapshot()->by_type(from)->release_memory(size);
as_snapshot()->by_type(to)->reserve_memory(size);
}
// Returns 0 if regions overlap; 1 if this region follows rgn; // -1 if this region precedes rgn.
inline int compare(const VirtualMemoryRegion& rgn) const {
if (overlap_region(rgn.base(), rgn.size())) { return0;
} else if (base() >= rgn.end()) { return1;
} else {
assert(rgn.base() >= end(), "Sanity"); return -1;
}
}
// Returns true if regions overlap, false otherwise.
inline bool equals(const VirtualMemoryRegion& rgn) const { return compare(rgn) == 0;
}
int compare_committed_region(const CommittedMemoryRegion&, const CommittedMemoryRegion&); class ReservedMemoryRegion : public VirtualMemoryRegion { private:
SortedLinkedList<CommittedMemoryRegion, compare_committed_region>
_committed_regions;
// move committed regions that higher than specified address to // the new region void move_committed_regions(address addr, ReservedMemoryRegion& rgn);
private: // The committed region contains the uncommitted region, subtract the uncommitted // region from this committed region bool remove_uncommitted_region(LinkedListNode<CommittedMemoryRegion>* node,
address addr, size_t sz);
int compare_reserved_region_base(const ReservedMemoryRegion& r1, const ReservedMemoryRegion& r2);
class VirtualMemoryWalker : public StackObj { public: virtualbool do_allocation_site(const ReservedMemoryRegion* rgn) { return false; }
};
// Main class called from MemTracker to track virtual memory allocations, commits and releases. class VirtualMemoryTracker : AllStatic {
friend class VirtualMemoryTrackerTest;
friend class CommittedVirtualMemoryTest;
// Given an existing memory mapping registered with NMT, split the mapping in // two. The newly created two mappings will be registered under the call // stack and the memory flags of the original section. staticbool split_reserved_region(address addr, size_t size, size_t split);
// Walk virtual memory data structure for creating baseline, etc. staticbool walk_virtual_memory(VirtualMemoryWalker* walker);
// If p is contained within a known memory region, print information about it to the // given stream and return true; false otherwise. staticbool print_containing_region(constvoid* p, outputStream* st);
// Snapshot current thread stacks staticvoid snapshot_thread_stacks();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.