comparison src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp @ 20218:828056cf311f

8040792: G1: Memory usage calculation uses sizeof(this) instead of sizeof(classname) Summary: A few locations in the code use sizeof(this) which returns the size of the pointer instead of sizeof(classname) which returns the size of the sum of its members. This change fixes these errors and adds a few tests. Reviewed-by: mgerdin, brutisso
author tschatzl
date Mon, 21 Jul 2014 09:40:19 +0200
parents 8cc89a893545
children a3953c777565
comparison
equal deleted inserted replaced
20217:6b52700a896b 20218:828056cf311f
337 size_t mem_size() { 337 size_t mem_size() {
338 MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); 338 MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
339 return _other_regions.mem_size() 339 return _other_regions.mem_size()
340 // This correction is necessary because the above includes the second 340 // This correction is necessary because the above includes the second
341 // part. 341 // part.
342 + (sizeof(this) - sizeof(OtherRegionsTable)) 342 + (sizeof(HeapRegionRemSet) - sizeof(OtherRegionsTable))
343 + strong_code_roots_mem_size(); 343 + strong_code_roots_mem_size();
344 } 344 }
345 345
346 // Returns the memory occupancy of all static data structures associated 346 // Returns the memory occupancy of all static data structures associated
347 // with remembered sets. 347 // with remembered sets.
348 static size_t static_mem_size() { 348 static size_t static_mem_size() {
349 return OtherRegionsTable::static_mem_size() + G1CodeRootSet::static_mem_size(); 349 return OtherRegionsTable::static_mem_size() + G1CodeRootSet::free_chunks_static_mem_size();
350 } 350 }
351 351
352 // Returns the memory occupancy of all free_list data structures associated 352 // Returns the memory occupancy of all free_list data structures associated
353 // with remembered sets. 353 // with remembered sets.
354 static size_t fl_mem_size() { 354 static size_t fl_mem_size() {