src/hotspot/share/services/mallocTracker.hpp
changeset 59269 ac6f7738a0ee
parent 59250 a6deb69743d4
equal deleted inserted replaced
59268:611f6bfe7c30 59269:ac6f7738a0ee
    68     if (sz > 0) {
    68     if (sz > 0) {
    69       Atomic::sub(&_size, sz);
    69       Atomic::sub(&_size, sz);
    70     }
    70     }
    71   }
    71   }
    72 
    72 
    73   inline void resize(long sz) {
    73   inline void resize(ssize_t sz) {
    74     if (sz != 0) {
    74     if (sz != 0) {
       
    75       assert(sz >= 0 || _size >= size_t(-sz), "Must be");
    75       Atomic::add(&_size, size_t(sz));
    76       Atomic::add(&_size, size_t(sz));
    76       DEBUG_ONLY(_peak_size = MAX2(_size, _peak_size);)
    77       DEBUG_ONLY(_peak_size = MAX2(_size, _peak_size);)
    77     }
    78     }
    78   }
    79   }
    79 
    80 
   111 
   112 
   112   inline void record_arena_free() {
   113   inline void record_arena_free() {
   113     _arena.deallocate(0);
   114     _arena.deallocate(0);
   114   }
   115   }
   115 
   116 
   116   inline void record_arena_size_change(long sz) {
   117   inline void record_arena_size_change(ssize_t sz) {
   117     _arena.resize(sz);
   118     _arena.resize(sz);
   118   }
   119   }
   119 
   120 
   120   inline size_t malloc_size()  const { return _malloc.size(); }
   121   inline size_t malloc_size()  const { return _malloc.size(); }
   121   inline size_t malloc_count() const { return _malloc.count();}
   122   inline size_t malloc_count() const { return _malloc.count();}
   205 
   206 
   206    static inline void record_arena_free(MEMFLAGS flag) {
   207    static inline void record_arena_free(MEMFLAGS flag) {
   207      as_snapshot()->by_type(flag)->record_arena_free();
   208      as_snapshot()->by_type(flag)->record_arena_free();
   208    }
   209    }
   209 
   210 
   210    static inline void record_arena_size_change(long size, MEMFLAGS flag) {
   211    static inline void record_arena_size_change(ssize_t size, MEMFLAGS flag) {
   211      as_snapshot()->by_type(flag)->record_arena_size_change(size);
   212      as_snapshot()->by_type(flag)->record_arena_size_change(size);
   212    }
   213    }
   213 
   214 
   214    static void snapshot(MallocMemorySnapshot* s) {
   215    static void snapshot(MallocMemorySnapshot* s) {
   215      as_snapshot()->copy_to(s);
   216      as_snapshot()->copy_to(s);
   359 
   360 
   360   static inline void record_arena_free(MEMFLAGS flags) {
   361   static inline void record_arena_free(MEMFLAGS flags) {
   361     MallocMemorySummary::record_arena_free(flags);
   362     MallocMemorySummary::record_arena_free(flags);
   362   }
   363   }
   363 
   364 
   364   static inline void record_arena_size_change(int size, MEMFLAGS flags) {
   365   static inline void record_arena_size_change(ssize_t size, MEMFLAGS flags) {
   365     MallocMemorySummary::record_arena_size_change(size, flags);
   366     MallocMemorySummary::record_arena_size_change(size, flags);
   366   }
   367   }
   367  private:
   368  private:
   368   static inline MallocHeader* malloc_header(void *memblock) {
   369   static inline MallocHeader* malloc_header(void *memblock) {
   369     assert(memblock != NULL, "NULL pointer");
   370     assert(memblock != NULL, "NULL pointer");