RFR: 8062870: src/share/vm/services/mallocTracker.hpp:64 assert(_count > 0) failed: Negative ,counter
Mikael Gerdin
mikael.gerdin at oracle.com
Mon Nov 10 17:56:44 UTC 2014
On 2014-11-10 18:39, Aleksey Shipilev wrote:
> On 10.11.2014 20:35, 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))
>
> Also, probably these two guys should be MAX_BUCKET_IDX and MAX_POS_IDX,
> respectively. (_pos_idx < MAX_BUCKET_LENGTH) looks more odd than
> (_pos_idx < MAX_POS_IDX).
>
>
>> 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?
Perhaps even STATIC_ASSERT(...)
/Mikael
>
> -Aleksey.
>
>
More information about the hotspot-runtime-dev
mailing list