From f473d94b9c81995777945eae947fff417d5f1dac Mon Sep 17 00:00:00 2001 From: John Cuthbertson Date: Fri, 6 Nov 2009 11:10:05 -0800 Subject: [PATCH] 6895788: G1: SATB and update buffer allocation code allocates too much space The type in the NEW_C_HEAP_ARRRY and FREE_C_HEAP_ARRAY calls in the buffer allocation code was changed from void* to char as the size argument had already been mulitipled by the byte size of an object pointer. Reviewed-by: ysr, tonyp --- hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp index 060743dd38a..a83f42a6a08 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp @@ -107,7 +107,7 @@ void** PtrQueueSet::allocate_buffer() { res[0] = NULL; return res; } else { - return NEW_C_HEAP_ARRAY(void*, _sz); + return (void**) NEW_C_HEAP_ARRAY(char, _sz); } } @@ -127,7 +127,8 @@ void PtrQueueSet::reduce_free_list() { assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong."); void** head = _buf_free_list; _buf_free_list = (void**)_buf_free_list[0]; - FREE_C_HEAP_ARRAY(void*,head); + FREE_C_HEAP_ARRAY(char, head); + _buf_free_list_sz --; n--; } }