src/share/vm/services/memSnapshot.cpp

Print this page
rev 3901 : JDK-8005012: Add WB APIs to better support NMT testing
Summary:


 372 }
 373 
 374 
 375 MemSnapshot::MemSnapshot() {
 376   if (MemTracker::track_callsite()) {
 377     _alloc_ptrs = new (std::nothrow) MemPointerArrayImpl<MemPointerRecordEx>();
 378     _vm_ptrs = new (std::nothrow)MemPointerArrayImpl<VMMemRegionEx>(64, true);
 379   } else {
 380     _alloc_ptrs = new (std::nothrow) MemPointerArrayImpl<MemPointerRecord>();
 381     _vm_ptrs = new (std::nothrow)MemPointerArrayImpl<VMMemRegion>(64, true);
 382   }
 383 
 384   _staging_area.init();
 385   _lock = new (std::nothrow) Mutex(Monitor::max_nonleaf - 1, "memSnapshotLock");
 386   NOT_PRODUCT(_untracked_count = 0;)
 387 }
 388 
 389 MemSnapshot::~MemSnapshot() {
 390   assert(MemTracker::shutdown_in_progress(), "native memory tracking still on");
 391   {
 392     MutexLockerEx locker(_lock);




 393     if (_alloc_ptrs != NULL) {
 394       delete _alloc_ptrs;
 395       _alloc_ptrs = NULL;
 396     }
 397 
 398     if (_vm_ptrs != NULL) {
 399       delete _vm_ptrs;
 400       _vm_ptrs = NULL;
 401     }
 402   }
 403 
 404   if (_lock != NULL) {
 405     delete _lock;
 406     _lock = NULL;
 407   }
 408 }
 409 
 410 
 411 void MemSnapshot::copy_seq_pointer(MemPointerRecord* dest, const MemPointerRecord* src) {
 412   assert(dest != NULL && src != NULL, "Just check");




 372 }
 373 
 374 
 375 MemSnapshot::MemSnapshot() {
 376   if (MemTracker::track_callsite()) {
 377     _alloc_ptrs = new (std::nothrow) MemPointerArrayImpl<MemPointerRecordEx>();
 378     _vm_ptrs = new (std::nothrow)MemPointerArrayImpl<VMMemRegionEx>(64, true);
 379   } else {
 380     _alloc_ptrs = new (std::nothrow) MemPointerArrayImpl<MemPointerRecord>();
 381     _vm_ptrs = new (std::nothrow)MemPointerArrayImpl<VMMemRegion>(64, true);
 382   }
 383 
 384   _staging_area.init();
 385   _lock = new (std::nothrow) Mutex(Monitor::max_nonleaf - 1, "memSnapshotLock");
 386   NOT_PRODUCT(_untracked_count = 0;)
 387 }
 388 
 389 MemSnapshot::~MemSnapshot() {
 390   assert(MemTracker::shutdown_in_progress(), "native memory tracking still on");
 391   {
 392     MonitorLockerEx locker(_lock);
 393 
 394     // wakeup all waiters
 395     locker.notify_all();
 396 
 397     if (_alloc_ptrs != NULL) {
 398       delete _alloc_ptrs;
 399       _alloc_ptrs = NULL;
 400     }
 401 
 402     if (_vm_ptrs != NULL) {
 403       delete _vm_ptrs;
 404       _vm_ptrs = NULL;
 405     }
 406   }
 407 
 408   if (_lock != NULL) {
 409     delete _lock;
 410     _lock = NULL;
 411   }
 412 }
 413 
 414 
 415 void MemSnapshot::copy_seq_pointer(MemPointerRecord* dest, const MemPointerRecord* src) {
 416   assert(dest != NULL && src != NULL, "Just check");