Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8164101 | 7u131 | David Buck | P4 | Resolved | Fixed | b01 |
The bug is found by running JDK 8 b109 inside valgrind
The various Arena constructor calls set_size_in_bytes(), like:
Arena::Arena() {
_first = _chunk = new (AllocFailStrategy::EXIT_OOM, Chunk::init_size) Chunk(Chunk::init_size);
_hwm = _chunk->bottom(); // Save the cached hwm, max
_max = _chunk->top();
set_size_in_bytes(Chunk::init_size);
NOT_PRODUCT(Atomic::inc(&_instance_count);)
}
void Arena::set_size_in_bytes(size_t size) {
if (_size_in_bytes != size) {
_size_in_bytes = size;
MemTracker::record_arena_size((address)this, size);
}
}
However, at this time, the _size_in_bytes field is not yet initialized, (and it might be equal to size just by chance).
The fix would be have a different method like
void Arena::init_size_in_bytes(size_t size) {
_size_in_bytes = size;
MemTracker::record_arena_size((address)this, size);
}
This should be fixed because it generates a lot of error messages inside valgrind.
The various Arena constructor calls set_size_in_bytes(), like:
Arena::Arena() {
_first = _chunk = new (AllocFailStrategy::EXIT_OOM, Chunk::init_size) Chunk(Chunk::init_size);
_hwm = _chunk->bottom(); // Save the cached hwm, max
_max = _chunk->top();
set_size_in_bytes(Chunk::init_size);
NOT_PRODUCT(Atomic::inc(&_instance_count);)
}
void Arena::set_size_in_bytes(size_t size) {
if (_size_in_bytes != size) {
_size_in_bytes = size;
MemTracker::record_arena_size((address)this, size);
}
}
However, at this time, the _size_in_bytes field is not yet initialized, (and it might be equal to size just by chance).
The fix would be have a different method like
void Arena::init_size_in_bytes(size_t size) {
_size_in_bytes = size;
MemTracker::record_arena_size((address)this, size);
}
This should be fixed because it generates a lot of error messages inside valgrind.
- backported by
-
JDK-8164101 valgrind: Conditional jump depends on uninitialised value in Arena::set_size_in_bytes()
-
- Resolved
-