src/share/vm/memory/allocation.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
8068451 Cdiff src/share/vm/memory/allocation.cpp
src/share/vm/memory/allocation.cpp
Print this page
*** 285,307 ****
if (cur != NULL) {
next = cur->next();
cur->set_next(NULL);
cur = next;
! _num_chunks = n;
! }
! }
! }
!
! // Free all remaining chunks, outside of ThreadCritical
! // to avoid deadlock with NMT
while(cur != NULL) {
next = cur->next();
os::free(cur);
cur = next;
}
}
// Accessors to preallocated pool's
static ChunkPool* large_pool() { assert(_large_pool != NULL, "must be initialized"); return _large_pool; }
static ChunkPool* medium_pool() { assert(_medium_pool != NULL, "must be initialized"); return _medium_pool; }
static ChunkPool* small_pool() { assert(_small_pool != NULL, "must be initialized"); return _small_pool; }
--- 285,306 ----
if (cur != NULL) {
next = cur->next();
cur->set_next(NULL);
cur = next;
! // Free all remaining chunks while in ThreadCritical lock
! // so NMT adjustment is stable.
while(cur != NULL) {
next = cur->next();
os::free(cur);
+ _num_chunks--;
cur = next;
}
}
+ }
+ }
+ }
// Accessors to preallocated pool's
static ChunkPool* large_pool() { assert(_large_pool != NULL, "must be initialized"); return _large_pool; }
static ChunkPool* medium_pool() { assert(_medium_pool != NULL, "must be initialized"); return _medium_pool; }
static ChunkPool* small_pool() { assert(_small_pool != NULL, "must be initialized"); return _small_pool; }
*** 382,392 ****
switch (c->length()) {
case Chunk::size: ChunkPool::large_pool()->free(c); break;
case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break;
case Chunk::init_size: ChunkPool::small_pool()->free(c); break;
case Chunk::tiny_size: ChunkPool::tiny_pool()->free(c); break;
! default: os::free(c);
}
}
Chunk::Chunk(size_t length) : _len(length) {
_next = NULL; // Chain on the linked list
--- 381,393 ----
switch (c->length()) {
case Chunk::size: ChunkPool::large_pool()->free(c); break;
case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break;
case Chunk::init_size: ChunkPool::small_pool()->free(c); break;
case Chunk::tiny_size: ChunkPool::tiny_pool()->free(c); break;
! default:
! ThreadCritical tc; // Free chunks under TC lock so that NMT adjustment is stable.
! os::free(c);
}
}
Chunk::Chunk(size_t length) : _len(length) {
_next = NULL; // Chain on the linked list
src/share/vm/memory/allocation.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File