hotspot/src/share/vm/services/mallocTracker.hpp
changeset 28953 75f0bfa6ea14
parent 27615 d7caba003432
child 46266 d5ccf56195af
equal deleted inserted replaced
28952:7fe008f8f88c 28953:75f0bfa6ea14
    27 
    27 
    28 #if INCLUDE_NMT
    28 #if INCLUDE_NMT
    29 
    29 
    30 #include "memory/allocation.hpp"
    30 #include "memory/allocation.hpp"
    31 #include "runtime/atomic.hpp"
    31 #include "runtime/atomic.hpp"
       
    32 #include "runtime/threadCritical.hpp"
    32 #include "services/nmtCommon.hpp"
    33 #include "services/nmtCommon.hpp"
    33 #include "utilities/nativeCallStack.hpp"
    34 #include "utilities/nativeCallStack.hpp"
    34 
    35 
    35 /*
    36 /*
    36  * This counter class counts memory allocation and deallocation,
    37  * This counter class counts memory allocation and deallocation,
   162     MallocMemorySnapshot* s = const_cast<MallocMemorySnapshot*>(this);
   163     MallocMemorySnapshot* s = const_cast<MallocMemorySnapshot*>(this);
   163     return s->by_type(mtThreadStack)->malloc_count();
   164     return s->by_type(mtThreadStack)->malloc_count();
   164   }
   165   }
   165 
   166 
   166   void copy_to(MallocMemorySnapshot* s) {
   167   void copy_to(MallocMemorySnapshot* s) {
       
   168     // Need to make sure that mtChunks don't get deallocated while the
       
   169     // copy is going on, because their size is adjusted using this
       
   170     // buffer in make_adjustment().
       
   171     ThreadCritical tc;
   167     s->_tracking_header = _tracking_header;
   172     s->_tracking_header = _tracking_header;
   168     for (int index = 0; index < mt_number_of_types; index ++) {
   173     for (int index = 0; index < mt_number_of_types; index ++) {
   169       s->_malloc[index] = _malloc[index];
   174       s->_malloc[index] = _malloc[index];
   170     }
   175     }
   171   }
   176   }