RFR: 8062870: src/share/vm/services/mallocTracker.hpp:64 assert(_count > 0) failed: Negative ,counter

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Nov 10 17:35:01 UTC 2014


On 10.11.2014 20:21, Coleen Phillimore wrote:
> Summary: Signed bitfield size y can only have (1 << y)-1 values.
> 
> We were overflowing the the _pos index and reusing the 0th element in
> the MallocSiteTable for two different stack traces which caused the
> assert for deallocation.
> 
> Tested with nsk.quick.testlist and jtreg runtime tests with
> -XX:NativeMemoryTracking=detail.
> 
> open webrev at http://cr.openjdk.java.net/~coleenp/8062870/
> bug link https://bugs.openjdk.java.net/browse/JDK-8062870

Looks good, but made my head hurt a little. I think it deserves a more
bullet-proof rework, a la:

#ifdef _LP64
  #define SIZE_BITS 64
  #define FLAGS_BITS 8
  #define POS_BITS 16
  #define BUCKET_BITS 40
#else
  #define SIZE_BITS 32
  #define FLAGS_BITS 8
  #define POS_BITS 8
  #define BUCKET_BITS 16
#endif  // _LP64

#define MAX_MALLOCSITE_TABLE_SIZE ((size_t)((1 << BUCKET_BITS)-1))
#define MAX_BUCKET_LENGTH         ((size_t)((1 << POS_BITS)-1))

 class MallocHeader VALUE_OBJ_CLASS_SPEC {
   size_t           _size      : SIZE_BITS;
   size_t           _flags     : FLAGS_BITS;
   size_t           _pos_idx   : POS_BITS;
   size_t           _bucket_idx: BUCKET_BITS;
 }

...and assert (SIZE_BITS + FLAGS_BITS + BUCKET_BITS + POS_BITS <=
2*BitsPerWord) somewhere?

-Aleksey.




More information about the hotspot-runtime-dev mailing list