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

Coleen Phillimore coleen.phillimore at oracle.com
Mon Nov 10 22:53:29 UTC 2014


Aleksey,

I made this change and I'm not happy with it.  Now I have 6 #defines to 
leak into the global hotspot namespace (can't undef because other code 
uses MAX_BUCKET_LENGTH, which relies on these #defines).

I think the differing constants within 10 lines of each other are less 
ugly and makes better sense.  They're more direct and less visually 
disturbing than the upper case names.

Also MAX_BUCKET_LENGTH is used in other NMT code where it's name makes a 
lot more sense, so I don't want to change that either.

Also the STATIC_ASSERT leads to the most unhelpful error message. I'm 
not a fan.

services/mallocTracker.hpp|264| error: aggregate ‘StaticAssert<false> 
DUMMY_STATIC_ASSERT’ has incomplete type and cannot be defined

Thank you for the comments which I initially agreed with but working 
with the code, makes me less happy and I will leave it as is (except one 
change which I'm going to put out shortly).

Thanks,
Coleen

On 11/10/14, 12:35 PM, Aleksey Shipilev wrote:
> 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