Tue, 14 May 2013 09:41:12 -0700
8012902: remove use of global operator new - take 2
Summary: The fix of 8010992, disable use of global operator new and new[] which caused failure on some tests. This takes two of the bugs also add ALLOW_OPERATOR_NEW_USAGE to prevent crash for third party code calling operator new of jvm on certain platforms.
Reviewed-by: coleenp, dholmes, zgu
Contributed-by: yumin.qi@oracle.com
1.1 --- a/make/bsd/makefiles/fastdebug.make Tue May 14 11:34:30 2013 +0400 1.2 +++ b/make/bsd/makefiles/fastdebug.make Tue May 14 09:41:12 2013 -0700 1.3 @@ -58,6 +58,6 @@ 1.4 # Linker mapfile 1.5 MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug 1.6 1.7 -VERSION = optimized 1.8 +VERSION = fastdebug 1.9 SYSDEFS += -DASSERT 1.10 PICFLAGS = DEFAULT
2.1 --- a/make/bsd/makefiles/vm.make Tue May 14 11:34:30 2013 +0400 2.2 +++ b/make/bsd/makefiles/vm.make Tue May 14 09:41:12 2013 -0700 2.3 @@ -144,6 +144,9 @@ 2.4 ifeq ($(OS_VENDOR), Darwin) 2.5 LIBJVM = lib$(JVM).dylib 2.6 CFLAGS += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE 2.7 + ifeq (${VERSION}, $(filter ${VERSION}, debug fastdebug)) 2.8 + CFLAGS += -DALLOW_OPERATOR_NEW_USAGE 2.9 + endif 2.10 else 2.11 LIBJVM = lib$(JVM).so 2.12 endif
3.1 --- a/src/os/windows/vm/os_windows.cpp Tue May 14 11:34:30 2013 +0400 3.2 +++ b/src/os/windows/vm/os_windows.cpp Tue May 14 09:41:12 2013 -0700 3.3 @@ -3307,7 +3307,7 @@ 3.4 assert(ret != SYS_THREAD_ERROR, "StartThread failed"); // should propagate back 3.5 } 3.6 3.7 -class HighResolutionInterval { 3.8 +class HighResolutionInterval : public CHeapObj<mtThread> { 3.9 // The default timer resolution seems to be 10 milliseconds. 3.10 // (Where is this written down?) 3.11 // If someone wants to sleep for only a fraction of the default,
4.1 --- a/src/share/vm/ci/ciReplay.cpp Tue May 14 11:34:30 2013 +0400 4.2 +++ b/src/share/vm/ci/ciReplay.cpp Tue May 14 09:41:12 2013 -0700 4.3 @@ -492,7 +492,9 @@ 4.4 } 4.5 Klass* k = parse_klass(CHECK); 4.6 rec->oops_offsets[i] = offset; 4.7 - rec->oops_handles[i] = (jobject)(new KlassHandle(THREAD, k)); 4.8 + KlassHandle *kh = NEW_C_HEAP_OBJ(KlassHandle, mtCompiler); 4.9 + ::new ((void*)kh) KlassHandle(THREAD, k); 4.10 + rec->oops_handles[i] = (jobject)kh; 4.11 } 4.12 } 4.13
5.1 --- a/src/share/vm/classfile/altHashing.cpp Tue May 14 11:34:30 2013 +0400 5.2 +++ b/src/share/vm/classfile/altHashing.cpp Tue May 14 09:41:12 2013 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -242,8 +242,8 @@ 5.11 void AltHashing::testMurmur3_32_ByteArray() { 5.12 // printf("testMurmur3_32_ByteArray\n"); 5.13 5.14 - jbyte* vector = new jbyte[256]; 5.15 - jbyte* hashes = new jbyte[4 * 256]; 5.16 + jbyte vector[256]; 5.17 + jbyte hashes[4 * 256]; 5.18 5.19 for (int i = 0; i < 256; i++) { 5.20 vector[i] = (jbyte) i;
6.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp Tue May 14 11:34:30 2013 +0400 6.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp Tue May 14 09:41:12 2013 -0700 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -52,7 +52,7 @@ 6.11 } 6.12 6.13 void ConcurrentMarkSweepPolicy::initialize_generations() { 6.14 - _generations = new GenerationSpecPtr[number_of_generations()]; 6.15 + _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC, 0, AllocFailStrategy::RETURN_NULL); 6.16 if (_generations == NULL) 6.17 vm_exit_during_initialization("Unable to allocate gen spec"); 6.18
7.1 --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Tue May 14 11:34:30 2013 +0400 7.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Tue May 14 09:41:12 2013 -0700 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -282,7 +282,8 @@ 7.11 _fine_eviction_stride = _max_fine_entries / _fine_eviction_sample_size; 7.12 } 7.13 7.14 - _fine_grain_regions = new PerRegionTablePtr[_max_fine_entries]; 7.15 + _fine_grain_regions = NEW_C_HEAP_ARRAY3(PerRegionTablePtr, _max_fine_entries, 7.16 + mtGC, 0, AllocFailStrategy::RETURN_NULL); 7.17 7.18 if (_fine_grain_regions == NULL) { 7.19 vm_exit_out_of_memory(sizeof(void*)*_max_fine_entries, OOM_MALLOC_ERROR,
8.1 --- a/src/share/vm/memory/allocation.cpp Tue May 14 11:34:30 2013 +0400 8.2 +++ b/src/share/vm/memory/allocation.cpp Tue May 14 09:41:12 2013 -0700 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -49,10 +49,15 @@ 8.11 # include "os_bsd.inline.hpp" 8.12 #endif 8.13 8.14 -void* StackObj::operator new(size_t size) { ShouldNotCallThis(); return 0; }; 8.15 -void StackObj::operator delete(void* p) { ShouldNotCallThis(); }; 8.16 -void* _ValueObj::operator new(size_t size) { ShouldNotCallThis(); return 0; }; 8.17 -void _ValueObj::operator delete(void* p) { ShouldNotCallThis(); }; 8.18 +void* StackObj::operator new(size_t size) { ShouldNotCallThis(); return 0; } 8.19 +void StackObj::operator delete(void* p) { ShouldNotCallThis(); } 8.20 +void* StackObj::operator new [](size_t size) { ShouldNotCallThis(); return 0; } 8.21 +void StackObj::operator delete [](void* p) { ShouldNotCallThis(); } 8.22 + 8.23 +void* _ValueObj::operator new(size_t size) { ShouldNotCallThis(); return 0; } 8.24 +void _ValueObj::operator delete(void* p) { ShouldNotCallThis(); } 8.25 +void* _ValueObj::operator new [](size_t size) { ShouldNotCallThis(); return 0; } 8.26 +void _ValueObj::operator delete [](void* p) { ShouldNotCallThis(); } 8.27 8.28 void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data, 8.29 size_t word_size, bool read_only, TRAPS) { 8.30 @@ -81,7 +86,6 @@ 8.31 st->print(" {"INTPTR_FORMAT"}", this); 8.32 } 8.33 8.34 - 8.35 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) { 8.36 address res; 8.37 switch (type) { 8.38 @@ -99,6 +103,10 @@ 8.39 return res; 8.40 } 8.41 8.42 +void* ResourceObj::operator new [](size_t size, allocation_type type, MEMFLAGS flags) { 8.43 + return (address) operator new(size, type, flags); 8.44 +} 8.45 + 8.46 void* ResourceObj::operator new(size_t size, const std::nothrow_t& nothrow_constant, 8.47 allocation_type type, MEMFLAGS flags) { 8.48 //should only call this with std::nothrow, use other operator new() otherwise 8.49 @@ -118,6 +126,10 @@ 8.50 return res; 8.51 } 8.52 8.53 +void* ResourceObj::operator new [](size_t size, const std::nothrow_t& nothrow_constant, 8.54 + allocation_type type, MEMFLAGS flags) { 8.55 + return (address)operator new(size, nothrow_constant, type, flags); 8.56 +} 8.57 8.58 void ResourceObj::operator delete(void* p) { 8.59 assert(((ResourceObj *)p)->allocated_on_C_heap(), 8.60 @@ -126,6 +138,10 @@ 8.61 FreeHeap(p); 8.62 } 8.63 8.64 +void ResourceObj::operator delete [](void* p) { 8.65 + operator delete(p); 8.66 +} 8.67 + 8.68 #ifdef ASSERT 8.69 void ResourceObj::set_allocation_type(address res, allocation_type type) { 8.70 // Set allocation type in the resource object 8.71 @@ -215,8 +231,6 @@ 8.72 tty->print_cr("Heap free " INTPTR_FORMAT, p); 8.73 } 8.74 8.75 -bool warn_new_operator = false; // see vm_main 8.76 - 8.77 //-------------------------------------------------------------------------------------- 8.78 // ChunkPool implementation 8.79 8.80 @@ -360,7 +374,7 @@ 8.81 void* Chunk::operator new(size_t requested_size, size_t length) { 8.82 // requested_size is equal to sizeof(Chunk) but in order for the arena 8.83 // allocations to come out aligned as expected the size must be aligned 8.84 - // to expected arean alignment. 8.85 + // to expected arena alignment. 8.86 // expect requested_size but if sizeof(Chunk) doesn't match isn't proper size we must align it. 8.87 assert(ARENA_ALIGN(requested_size) == aligned_overhead_size(), "Bad alignment"); 8.88 size_t bytes = ARENA_ALIGN(requested_size) + length; 8.89 @@ -669,19 +683,40 @@ 8.90 // a memory leak. Use CHeapObj as the base class of such objects to make it explicit 8.91 // that they're allocated on the C heap. 8.92 // Commented out in product version to avoid conflicts with third-party C++ native code. 8.93 -// %% note this is causing a problem on solaris debug build. the global 8.94 -// new is being called from jdk source and causing data corruption. 8.95 -// src/share/native/sun/awt/font/fontmanager/textcache/hsMemory.cpp::hsSoftNew 8.96 -// define CATCH_OPERATOR_NEW_USAGE if you want to use this. 8.97 -#ifdef CATCH_OPERATOR_NEW_USAGE 8.98 +// On certain platforms, such as Mac OS X (Darwin), in debug version, new is being called 8.99 +// from jdk source and causing data corruption. Such as 8.100 +// Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair 8.101 +// define ALLOW_OPERATOR_NEW_USAGE for platform on which global operator new allowed. 8.102 +// 8.103 +#ifndef ALLOW_OPERATOR_NEW_USAGE 8.104 void* operator new(size_t size){ 8.105 - static bool warned = false; 8.106 - if (!warned && warn_new_operator) 8.107 - warning("should not call global (default) operator new"); 8.108 - warned = true; 8.109 - return (void *) AllocateHeap(size, "global operator new"); 8.110 + assert(false, "Should not call global operator new"); 8.111 + return 0; 8.112 } 8.113 -#endif 8.114 + 8.115 +void* operator new [](size_t size){ 8.116 + assert(false, "Should not call global operator new[]"); 8.117 + return 0; 8.118 +} 8.119 + 8.120 +void* operator new(size_t size, const std::nothrow_t& nothrow_constant){ 8.121 + assert(false, "Should not call global operator new"); 8.122 + return 0; 8.123 +} 8.124 + 8.125 +void* operator new [](size_t size, std::nothrow_t& nothrow_constant){ 8.126 + assert(false, "Should not call global operator new[]"); 8.127 + return 0; 8.128 +} 8.129 + 8.130 +void operator delete(void* p) { 8.131 + assert(false, "Should not call global delete"); 8.132 +} 8.133 + 8.134 +void operator delete [](void* p) { 8.135 + assert(false, "Should not call global delete []"); 8.136 +} 8.137 +#endif // ALLOW_OPERATOR_NEW_USAGE 8.138 8.139 void AllocatedObj::print() const { print_on(tty); } 8.140 void AllocatedObj::print_value() const { print_value_on(tty); }
9.1 --- a/src/share/vm/memory/allocation.hpp Tue May 14 11:34:30 2013 +0400 9.2 +++ b/src/share/vm/memory/allocation.hpp Tue May 14 09:41:12 2013 -0700 9.3 @@ -1,5 +1,5 @@ 9.4 /* 9.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 9.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 9.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.8 * 9.9 * This code is free software; you can redistribute it and/or modify it 9.10 @@ -86,12 +86,23 @@ 9.11 // subclasses. 9.12 // 9.13 // The following macros and function should be used to allocate memory 9.14 -// directly in the resource area or in the C-heap: 9.15 +// directly in the resource area or in the C-heap, The _OBJ variants 9.16 +// of the NEW/FREE_C_HEAP macros are used for alloc/dealloc simple 9.17 +// objects which are not inherited from CHeapObj, note constructor and 9.18 +// destructor are not called. The preferable way to allocate objects 9.19 +// is using the new operator. 9.20 // 9.21 -// NEW_RESOURCE_ARRAY(type,size) 9.22 +// WARNING: The array variant must only be used for a homogenous array 9.23 +// where all objects are of the exact type specified. If subtypes are 9.24 +// stored in the array then must pay attention to calling destructors 9.25 +// at needed. 9.26 +// 9.27 +// NEW_RESOURCE_ARRAY(type, size) 9.28 // NEW_RESOURCE_OBJ(type) 9.29 -// NEW_C_HEAP_ARRAY(type,size) 9.30 -// NEW_C_HEAP_OBJ(type) 9.31 +// NEW_C_HEAP_ARRAY(type, size) 9.32 +// NEW_C_HEAP_OBJ(type, memflags) 9.33 +// FREE_C_HEAP_ARRAY(type, old, memflags) 9.34 +// FREE_C_HEAP_OBJ(objname, type, memflags) 9.35 // char* AllocateHeap(size_t size, const char* name); 9.36 // void FreeHeap(void* p); 9.37 // 9.38 @@ -195,8 +206,11 @@ 9.39 _NOINLINE_ void* operator new(size_t size, address caller_pc = 0); 9.40 _NOINLINE_ void* operator new (size_t size, const std::nothrow_t& nothrow_constant, 9.41 address caller_pc = 0); 9.42 - 9.43 + _NOINLINE_ void* operator new [](size_t size, address caller_pc = 0); 9.44 + _NOINLINE_ void* operator new [](size_t size, const std::nothrow_t& nothrow_constant, 9.45 + address caller_pc = 0); 9.46 void operator delete(void* p); 9.47 + void operator delete [] (void* p); 9.48 }; 9.49 9.50 // Base class for objects allocated on the stack only. 9.51 @@ -206,6 +220,8 @@ 9.52 private: 9.53 void* operator new(size_t size); 9.54 void operator delete(void* p); 9.55 + void* operator new [](size_t size); 9.56 + void operator delete [](void* p); 9.57 }; 9.58 9.59 // Base class for objects used as value objects. 9.60 @@ -229,7 +245,9 @@ 9.61 class _ValueObj { 9.62 private: 9.63 void* operator new(size_t size); 9.64 - void operator delete(void* p); 9.65 + void operator delete(void* p); 9.66 + void* operator new [](size_t size); 9.67 + void operator delete [](void* p); 9.68 }; 9.69 9.70 9.71 @@ -510,13 +528,24 @@ 9.72 9.73 public: 9.74 void* operator new(size_t size, allocation_type type, MEMFLAGS flags); 9.75 + void* operator new [](size_t size, allocation_type type, MEMFLAGS flags); 9.76 void* operator new(size_t size, const std::nothrow_t& nothrow_constant, 9.77 allocation_type type, MEMFLAGS flags); 9.78 + void* operator new [](size_t size, const std::nothrow_t& nothrow_constant, 9.79 + allocation_type type, MEMFLAGS flags); 9.80 + 9.81 void* operator new(size_t size, Arena *arena) { 9.82 address res = (address)arena->Amalloc(size); 9.83 DEBUG_ONLY(set_allocation_type(res, ARENA);) 9.84 return res; 9.85 } 9.86 + 9.87 + void* operator new [](size_t size, Arena *arena) { 9.88 + address res = (address)arena->Amalloc(size); 9.89 + DEBUG_ONLY(set_allocation_type(res, ARENA);) 9.90 + return res; 9.91 + } 9.92 + 9.93 void* operator new(size_t size) { 9.94 address res = (address)resource_allocate_bytes(size); 9.95 DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);) 9.96 @@ -529,7 +558,20 @@ 9.97 return res; 9.98 } 9.99 9.100 + void* operator new [](size_t size) { 9.101 + address res = (address)resource_allocate_bytes(size); 9.102 + DEBUG_ONLY(set_allocation_type(res, RESOURCE_AREA);) 9.103 + return res; 9.104 + } 9.105 + 9.106 + void* operator new [](size_t size, const std::nothrow_t& nothrow_constant) { 9.107 + address res = (address)resource_allocate_bytes(size, AllocFailStrategy::RETURN_NULL); 9.108 + DEBUG_ONLY(if (res != NULL) set_allocation_type(res, RESOURCE_AREA);) 9.109 + return res; 9.110 + } 9.111 + 9.112 void operator delete(void* p); 9.113 + void operator delete [](void* p); 9.114 }; 9.115 9.116 // One of the following macros must be used when allocating an array 9.117 @@ -563,24 +605,25 @@ 9.118 #define REALLOC_C_HEAP_ARRAY(type, old, size, memflags)\ 9.119 (type*) (ReallocateHeap((char*)old, (size) * sizeof(type), memflags)) 9.120 9.121 -#define FREE_C_HEAP_ARRAY(type,old,memflags) \ 9.122 +#define FREE_C_HEAP_ARRAY(type, old, memflags) \ 9.123 FreeHeap((char*)(old), memflags) 9.124 9.125 -#define NEW_C_HEAP_OBJ(type, memflags)\ 9.126 - NEW_C_HEAP_ARRAY(type, 1, memflags) 9.127 - 9.128 - 9.129 #define NEW_C_HEAP_ARRAY2(type, size, memflags, pc)\ 9.130 (type*) (AllocateHeap((size) * sizeof(type), memflags, pc)) 9.131 9.132 #define REALLOC_C_HEAP_ARRAY2(type, old, size, memflags, pc)\ 9.133 (type*) (ReallocateHeap((char*)old, (size) * sizeof(type), memflags, pc)) 9.134 9.135 -#define NEW_C_HEAP_OBJ2(type, memflags, pc)\ 9.136 - NEW_C_HEAP_ARRAY2(type, 1, memflags, pc) 9.137 +#define NEW_C_HEAP_ARRAY3(type, size, memflags, pc, allocfail) \ 9.138 + (type*) AllocateHeap(size * sizeof(type), memflags, pc, allocfail) 9.139 9.140 +// allocate type in heap without calling ctor 9.141 +#define NEW_C_HEAP_OBJ(type, memflags)\ 9.142 + NEW_C_HEAP_ARRAY(type, 1, memflags) 9.143 9.144 -extern bool warn_new_operator; 9.145 +// deallocate obj of type in heap without calling dtor 9.146 +#define FREE_C_HEAP_OBJ(objname, memflags)\ 9.147 + FreeHeap((char*)objname, memflags); 9.148 9.149 // for statistics 9.150 #ifndef PRODUCT
10.1 --- a/src/share/vm/memory/allocation.inline.hpp Tue May 14 11:34:30 2013 +0400 10.2 +++ b/src/share/vm/memory/allocation.inline.hpp Tue May 14 09:41:12 2013 -0700 10.3 @@ -86,30 +86,39 @@ 10.4 10.5 template <MEMFLAGS F> void* CHeapObj<F>::operator new(size_t size, 10.6 address caller_pc){ 10.7 + void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC)); 10.8 #ifdef ASSERT 10.9 - void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC)); 10.10 if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p); 10.11 +#endif 10.12 return p; 10.13 -#else 10.14 - return (void *) AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC)); 10.15 -#endif 10.16 } 10.17 10.18 template <MEMFLAGS F> void* CHeapObj<F>::operator new (size_t size, 10.19 const std::nothrow_t& nothrow_constant, address caller_pc) { 10.20 -#ifdef ASSERT 10.21 void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC), 10.22 AllocFailStrategy::RETURN_NULL); 10.23 +#ifdef ASSERT 10.24 if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p); 10.25 +#endif 10.26 return p; 10.27 -#else 10.28 - return (void *) AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC), 10.29 - AllocFailStrategy::RETURN_NULL); 10.30 -#endif 10.31 +} 10.32 + 10.33 +template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size, 10.34 + address caller_pc){ 10.35 + return CHeapObj<F>::operator new(size, caller_pc); 10.36 +} 10.37 + 10.38 +template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size, 10.39 + const std::nothrow_t& nothrow_constant, address caller_pc) { 10.40 + return CHeapObj<F>::operator new(size, nothrow_constant, caller_pc); 10.41 } 10.42 10.43 template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){ 10.44 - FreeHeap(p, F); 10.45 + FreeHeap(p, F); 10.46 +} 10.47 + 10.48 +template <MEMFLAGS F> void CHeapObj<F>::operator delete [](void* p){ 10.49 + FreeHeap(p, F); 10.50 } 10.51 10.52 template <class E, MEMFLAGS F>
11.1 --- a/src/share/vm/memory/cardTableModRefBS.cpp Tue May 14 11:34:30 2013 +0400 11.2 +++ b/src/share/vm/memory/cardTableModRefBS.cpp Tue May 14 09:41:12 2013 -0700 11.3 @@ -1,5 +1,5 @@ 11.4 /* 11.5 - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 11.6 + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 11.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 * 11.9 * This code is free software; you can redistribute it and/or modify it 11.10 @@ -80,15 +80,11 @@ 11.11 11.12 _covered = new MemRegion[max_covered_regions]; 11.13 _committed = new MemRegion[max_covered_regions]; 11.14 - if (_covered == NULL || _committed == NULL) 11.15 + if (_covered == NULL || _committed == NULL) { 11.16 vm_exit_during_initialization("couldn't alloc card table covered region set."); 11.17 - int i; 11.18 - for (i = 0; i < max_covered_regions; i++) { 11.19 - _covered[i].set_word_size(0); 11.20 - _committed[i].set_word_size(0); 11.21 } 11.22 + 11.23 _cur_covered_regions = 0; 11.24 - 11.25 const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 : 11.26 MAX2(_page_size, (size_t) os::vm_allocation_granularity()); 11.27 ReservedSpace heap_rs(_byte_map_size, rs_align, false); 11.28 @@ -134,7 +130,7 @@ 11.29 || _lowest_non_clean_base_chunk_index == NULL 11.30 || _last_LNC_resizing_collection == NULL) 11.31 vm_exit_during_initialization("couldn't allocate an LNC array."); 11.32 - for (i = 0; i < max_covered_regions; i++) { 11.33 + for (int i = 0; i < max_covered_regions; i++) { 11.34 _lowest_non_clean[i] = NULL; 11.35 _lowest_non_clean_chunk_size[i] = 0; 11.36 _last_LNC_resizing_collection[i] = -1; 11.37 @@ -153,6 +149,33 @@ 11.38 } 11.39 } 11.40 11.41 +CardTableModRefBS::~CardTableModRefBS() { 11.42 + if (_covered) { 11.43 + delete[] _covered; 11.44 + _covered = NULL; 11.45 + } 11.46 + if (_committed) { 11.47 + delete[] _committed; 11.48 + _committed = NULL; 11.49 + } 11.50 + if (_lowest_non_clean) { 11.51 + FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC); 11.52 + _lowest_non_clean = NULL; 11.53 + } 11.54 + if (_lowest_non_clean_chunk_size) { 11.55 + FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC); 11.56 + _lowest_non_clean_chunk_size = NULL; 11.57 + } 11.58 + if (_lowest_non_clean_base_chunk_index) { 11.59 + FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC); 11.60 + _lowest_non_clean_base_chunk_index = NULL; 11.61 + } 11.62 + if (_last_LNC_resizing_collection) { 11.63 + FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC); 11.64 + _last_LNC_resizing_collection = NULL; 11.65 + } 11.66 +} 11.67 + 11.68 int CardTableModRefBS::find_covering_region_by_base(HeapWord* base) { 11.69 int i; 11.70 for (i = 0; i < _cur_covered_regions; i++) {
12.1 --- a/src/share/vm/memory/cardTableModRefBS.hpp Tue May 14 11:34:30 2013 +0400 12.2 +++ b/src/share/vm/memory/cardTableModRefBS.hpp Tue May 14 09:41:12 2013 -0700 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 12.6 + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 12.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.8 * 12.9 * This code is free software; you can redistribute it and/or modify it 12.10 @@ -280,6 +280,7 @@ 12.11 } 12.12 12.13 CardTableModRefBS(MemRegion whole_heap, int max_covered_regions); 12.14 + ~CardTableModRefBS(); 12.15 12.16 // *** Barrier set functions. 12.17
13.1 --- a/src/share/vm/memory/cardTableRS.cpp Tue May 14 11:34:30 2013 +0400 13.2 +++ b/src/share/vm/memory/cardTableRS.cpp Tue May 14 09:41:12 2013 -0700 13.3 @@ -1,5 +1,5 @@ 13.4 /* 13.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 13.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 13.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.8 * 13.9 * This code is free software; you can redistribute it and/or modify it 13.10 @@ -54,9 +54,10 @@ 13.11 _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions); 13.12 #endif 13.13 set_bs(_ct_bs); 13.14 - _last_cur_val_in_gen = new jbyte[GenCollectedHeap::max_gens + 1]; 13.15 + _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(jbyte, GenCollectedHeap::max_gens + 1, 13.16 + mtGC, 0, AllocFailStrategy::RETURN_NULL); 13.17 if (_last_cur_val_in_gen == NULL) { 13.18 - vm_exit_during_initialization("Could not last_cur_val_in_gen array."); 13.19 + vm_exit_during_initialization("Could not create last_cur_val_in_gen array."); 13.20 } 13.21 for (int i = 0; i < GenCollectedHeap::max_gens + 1; i++) { 13.22 _last_cur_val_in_gen[i] = clean_card_val(); 13.23 @@ -64,6 +65,16 @@ 13.24 _ct_bs->set_CTRS(this); 13.25 } 13.26 13.27 +CardTableRS::~CardTableRS() { 13.28 + if (_ct_bs) { 13.29 + delete _ct_bs; 13.30 + _ct_bs = NULL; 13.31 + } 13.32 + if (_last_cur_val_in_gen) { 13.33 + FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen, mtInternal); 13.34 + } 13.35 +} 13.36 + 13.37 void CardTableRS::resize_covered_region(MemRegion new_region) { 13.38 _ct_bs->resize_covered_region(new_region); 13.39 }
14.1 --- a/src/share/vm/memory/cardTableRS.hpp Tue May 14 11:34:30 2013 +0400 14.2 +++ b/src/share/vm/memory/cardTableRS.hpp Tue May 14 09:41:12 2013 -0700 14.3 @@ -1,5 +1,5 @@ 14.4 /* 14.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 14.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 14.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.8 * 14.9 * This code is free software; you can redistribute it and/or modify it 14.10 @@ -102,6 +102,7 @@ 14.11 14.12 public: 14.13 CardTableRS(MemRegion whole_heap, int max_covered_regions); 14.14 + ~CardTableRS(); 14.15 14.16 // *** GenRemSet functions. 14.17 GenRemSet::Name rs_kind() { return GenRemSet::CardTable; }
15.1 --- a/src/share/vm/memory/collectorPolicy.cpp Tue May 14 11:34:30 2013 +0400 15.2 +++ b/src/share/vm/memory/collectorPolicy.cpp Tue May 14 09:41:12 2013 -0700 15.3 @@ -856,7 +856,7 @@ 15.4 } 15.5 15.6 void MarkSweepPolicy::initialize_generations() { 15.7 - _generations = new GenerationSpecPtr[number_of_generations()]; 15.8 + _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC, 0, AllocFailStrategy::RETURN_NULL); 15.9 if (_generations == NULL) 15.10 vm_exit_during_initialization("Unable to allocate gen spec"); 15.11
16.1 --- a/src/share/vm/memory/memRegion.cpp Tue May 14 11:34:30 2013 +0400 16.2 +++ b/src/share/vm/memory/memRegion.cpp Tue May 14 09:41:12 2013 -0700 16.3 @@ -23,6 +23,8 @@ 16.4 */ 16.5 16.6 #include "precompiled.hpp" 16.7 +#include "memory/allocation.hpp" 16.8 +#include "memory/allocation.inline.hpp" 16.9 #include "memory/memRegion.hpp" 16.10 #include "runtime/globals.hpp" 16.11 16.12 @@ -99,3 +101,19 @@ 16.13 ShouldNotReachHere(); 16.14 return MemRegion(); 16.15 } 16.16 + 16.17 +void* MemRegion::operator new(size_t size) { 16.18 + return (address)AllocateHeap(size, mtGC, 0, AllocFailStrategy::RETURN_NULL); 16.19 +} 16.20 + 16.21 +void* MemRegion::operator new [](size_t size) { 16.22 + return (address)AllocateHeap(size, mtGC, 0, AllocFailStrategy::RETURN_NULL); 16.23 +} 16.24 +void MemRegion::operator delete(void* p) { 16.25 + FreeHeap(p, mtGC); 16.26 +} 16.27 + 16.28 +void MemRegion::operator delete [](void* p) { 16.29 + FreeHeap(p, mtGC); 16.30 +} 16.31 +
17.1 --- a/src/share/vm/memory/memRegion.hpp Tue May 14 11:34:30 2013 +0400 17.2 +++ b/src/share/vm/memory/memRegion.hpp Tue May 14 09:41:12 2013 -0700 17.3 @@ -34,7 +34,9 @@ 17.4 17.5 // Note that MemRegions are passed by value, not by reference. 17.6 // The intent is that they remain very small and contain no 17.7 -// objects. 17.8 +// objects. _ValueObj should never be allocated in heap but we do 17.9 +// create MemRegions (in CardTableModRefBS) in heap so operator 17.10 +// new and operator new [] added for this special case. 17.11 17.12 class MetaWord; 17.13 17.14 @@ -92,6 +94,10 @@ 17.15 size_t word_size() const { return _word_size; } 17.16 17.17 bool is_empty() const { return word_size() == 0; } 17.18 + void* operator new(size_t size); 17.19 + void* operator new [](size_t size); 17.20 + void operator delete(void* p); 17.21 + void operator delete [](void* p); 17.22 }; 17.23 17.24 // For iteration over MemRegion's.
18.1 --- a/src/share/vm/opto/idealGraphPrinter.hpp Tue May 14 11:34:30 2013 +0400 18.2 +++ b/src/share/vm/opto/idealGraphPrinter.hpp Tue May 14 09:41:12 2013 -0700 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -41,9 +41,8 @@ 18.11 class InlineTree; 18.12 class ciMethod; 18.13 18.14 -class IdealGraphPrinter 18.15 -{ 18.16 -private: 18.17 +class IdealGraphPrinter : public CHeapObj<mtCompiler> { 18.18 + private: 18.19 18.20 static const char *INDENT; 18.21 static const char *TOP_ELEMENT; 18.22 @@ -121,7 +120,7 @@ 18.23 IdealGraphPrinter(); 18.24 ~IdealGraphPrinter(); 18.25 18.26 -public: 18.27 + public: 18.28 18.29 static void clean_up(); 18.30 static IdealGraphPrinter *printer(); 18.31 @@ -135,8 +134,6 @@ 18.32 void print_method(Compile* compile, const char *name, int level=1, bool clear_nodes = false); 18.33 void print(Compile* compile, const char *name, Node *root, int level=1, bool clear_nodes = false); 18.34 void print_xml(const char *name); 18.35 - 18.36 - 18.37 }; 18.38 18.39 #endif
19.1 --- a/src/share/vm/runtime/handles.cpp Tue May 14 11:34:30 2013 +0400 19.2 +++ b/src/share/vm/runtime/handles.cpp Tue May 14 09:41:12 2013 -0700 19.3 @@ -179,6 +179,22 @@ 19.4 _thread->set_last_handle_mark(previous_handle_mark()); 19.5 } 19.6 19.7 +void* HandleMark::operator new(size_t size) { 19.8 + return AllocateHeap(size, mtThread); 19.9 +} 19.10 + 19.11 +void* HandleMark::operator new [] (size_t size) { 19.12 + return AllocateHeap(size, mtThread); 19.13 +} 19.14 + 19.15 +void HandleMark::operator delete(void* p) { 19.16 + FreeHeap(p, mtThread); 19.17 +} 19.18 + 19.19 +void HandleMark::operator delete[](void* p) { 19.20 + FreeHeap(p, mtThread); 19.21 +} 19.22 + 19.23 #ifdef ASSERT 19.24 19.25 NoHandleMark::NoHandleMark() {
20.1 --- a/src/share/vm/runtime/handles.hpp Tue May 14 11:34:30 2013 +0400 20.2 +++ b/src/share/vm/runtime/handles.hpp Tue May 14 09:41:12 2013 -0700 20.3 @@ -1,5 +1,5 @@ 20.4 /* 20.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 20.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 * 20.9 * This code is free software; you can redistribute it and/or modify it 20.10 @@ -281,7 +281,7 @@ 20.11 // across the HandleMark boundary. 20.12 20.13 // The base class of HandleMark should have been StackObj but we also heap allocate 20.14 -// a HandleMark when a thread is created. 20.15 +// a HandleMark when a thread is created. The operator new is for this special case. 20.16 20.17 class HandleMark { 20.18 private: 20.19 @@ -308,6 +308,11 @@ 20.20 void push(); 20.21 // called in the destructor of HandleMarkCleaner 20.22 void pop_and_restore(); 20.23 + // overloaded operators 20.24 + void* operator new(size_t size); 20.25 + void* operator new [](size_t size); 20.26 + void operator delete(void* p); 20.27 + void operator delete[](void* p); 20.28 }; 20.29 20.30 //------------------------------------------------------------------------------------------------------------------------
21.1 --- a/src/share/vm/runtime/objectMonitor.hpp Tue May 14 11:34:30 2013 +0400 21.2 +++ b/src/share/vm/runtime/objectMonitor.hpp Tue May 14 09:41:12 2013 -0700 21.3 @@ -303,6 +303,18 @@ 21.4 public: 21.5 static int Knob_Verbose; 21.6 static int Knob_SpinLimit; 21.7 + void* operator new (size_t size) { 21.8 + return AllocateHeap(size, mtInternal); 21.9 + } 21.10 + void* operator new[] (size_t size) { 21.11 + return operator new (size); 21.12 + } 21.13 + void operator delete(void* p) { 21.14 + FreeHeap(p, mtInternal); 21.15 + } 21.16 + void operator delete[] (void *p) { 21.17 + operator delete(p); 21.18 + } 21.19 }; 21.20 21.21 #undef TEVENT
22.1 --- a/src/share/vm/runtime/reflectionUtils.hpp Tue May 14 11:34:30 2013 +0400 22.2 +++ b/src/share/vm/runtime/reflectionUtils.hpp Tue May 14 09:41:12 2013 -0700 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 22.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -136,10 +136,10 @@ 22.11 } 22.12 }; 22.13 22.14 -class FilteredField { 22.15 +class FilteredField : public CHeapObj<mtInternal> { 22.16 private: 22.17 Klass* _klass; 22.18 - int _field_offset; 22.19 + int _field_offset; 22.20 22.21 public: 22.22 FilteredField(Klass* klass, int field_offset) {
23.1 --- a/src/share/vm/runtime/unhandledOops.hpp Tue May 14 11:34:30 2013 +0400 23.2 +++ b/src/share/vm/runtime/unhandledOops.hpp Tue May 14 09:41:12 2013 -0700 23.3 @@ -48,7 +48,7 @@ 23.4 class oop; 23.5 class Thread; 23.6 23.7 -class UnhandledOopEntry { 23.8 +class UnhandledOopEntry : public CHeapObj<mtThread> { 23.9 friend class UnhandledOops; 23.10 private: 23.11 oop* _oop_ptr; 23.12 @@ -62,7 +62,7 @@ 23.13 }; 23.14 23.15 23.16 -class UnhandledOops { 23.17 +class UnhandledOops : public CHeapObj<mtThread> { 23.18 friend class Thread; 23.19 private: 23.20 Thread* _thread;
24.1 --- a/src/share/vm/runtime/vmStructs.cpp Tue May 14 11:34:30 2013 +0400 24.2 +++ b/src/share/vm/runtime/vmStructs.cpp Tue May 14 09:41:12 2013 -0700 24.3 @@ -3119,15 +3119,15 @@ 24.4 // Search for the base type by peeling off const and * 24.5 size_t len = strlen(typeName); 24.6 if (typeName[len-1] == '*') { 24.7 - char * s = new char[len]; 24.8 + char * s = NEW_C_HEAP_ARRAY(char, len, mtInternal); 24.9 strncpy(s, typeName, len - 1); 24.10 s[len-1] = '\0'; 24.11 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); 24.12 if (recursiveFindType(origtypes, s, true) == 1) { 24.13 - delete [] s; 24.14 + FREE_C_HEAP_ARRAY(char, s, mtInternal); 24.15 return 1; 24.16 } 24.17 - delete [] s; 24.18 + FREE_C_HEAP_ARRAY(char, s, mtInternal); 24.19 } 24.20 const char* start = NULL; 24.21 if (strstr(typeName, "GrowableArray<") == typeName) { 24.22 @@ -3138,15 +3138,15 @@ 24.23 if (start != NULL) { 24.24 const char * end = strrchr(typeName, '>'); 24.25 int len = end - start + 1; 24.26 - char * s = new char[len]; 24.27 + char * s = NEW_C_HEAP_ARRAY(char, len, mtInternal); 24.28 strncpy(s, start, len - 1); 24.29 s[len-1] = '\0'; 24.30 // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); 24.31 if (recursiveFindType(origtypes, s, true) == 1) { 24.32 - delete [] s; 24.33 + FREE_C_HEAP_ARRAY(char, s, mtInternal); 24.34 return 1; 24.35 } 24.36 - delete [] s; 24.37 + FREE_C_HEAP_ARRAY(char, s, mtInternal); 24.38 } 24.39 if (strstr(typeName, "const ") == typeName) { 24.40 const char * s = typeName + strlen("const ");
25.1 --- a/src/share/vm/utilities/events.hpp Tue May 14 11:34:30 2013 +0400 25.2 +++ b/src/share/vm/utilities/events.hpp Tue May 14 09:41:12 2013 -0700 25.3 @@ -1,5 +1,5 @@ 25.4 /* 25.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 25.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 25.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.8 * 25.9 * This code is free software; you can redistribute it and/or modify it 25.10 @@ -69,7 +69,7 @@ 25.11 // semantics aren't appropriate. The name is used as the label of the 25.12 // log when it is dumped during a crash. 25.13 template <class T> class EventLogBase : public EventLog { 25.14 - template <class X> class EventRecord { 25.15 + template <class X> class EventRecord : public CHeapObj<mtInternal> { 25.16 public: 25.17 double timestamp; 25.18 Thread* thread;
26.1 --- a/src/share/vm/utilities/quickSort.cpp Tue May 14 11:34:30 2013 +0400 26.2 +++ b/src/share/vm/utilities/quickSort.cpp Tue May 14 09:41:12 2013 -0700 26.3 @@ -1,5 +1,5 @@ 26.4 /* 26.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 26.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 26.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.8 * 26.9 * This code is free software; you can redistribute it and/or modify it 26.10 @@ -30,6 +30,8 @@ 26.11 26.12 #include "runtime/os.hpp" 26.13 #include "utilities/quickSort.hpp" 26.14 +#include "memory/allocation.hpp" 26.15 +#include "memory/allocation.inline.hpp" 26.16 #include <stdlib.h> 26.17 26.18 static int test_comparator(int a, int b) { 26.19 @@ -187,8 +189,8 @@ 26.20 // test sorting random arrays 26.21 for (int i = 0; i < 1000; i++) { 26.22 int length = os::random() % 100; 26.23 - int* test_array = new int[length]; 26.24 - int* expected_array = new int[length]; 26.25 + int* test_array = NEW_C_HEAP_ARRAY(int, length, mtInternal); 26.26 + int* expected_array = NEW_C_HEAP_ARRAY(int, length, mtInternal); 26.27 for (int j = 0; j < length; j++) { 26.28 // Choose random values, but get a chance of getting duplicates 26.29 test_array[j] = os::random() % (length * 2); 26.30 @@ -210,8 +212,8 @@ 26.31 sort(test_array, length, test_even_odd_comparator, true); 26.32 assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent"); 26.33 26.34 - delete[] test_array; 26.35 - delete[] expected_array; 26.36 + FREE_C_HEAP_ARRAY(int, test_array, mtInternal); 26.37 + FREE_C_HEAP_ARRAY(int, expected_array, mtInternal); 26.38 } 26.39 } 26.40
27.1 --- a/src/share/vm/utilities/workgroup.cpp Tue May 14 11:34:30 2013 +0400 27.2 +++ b/src/share/vm/utilities/workgroup.cpp Tue May 14 09:41:12 2013 -0700 27.3 @@ -1,5 +1,5 @@ 27.4 /* 27.5 - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 27.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 27.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.8 * 27.9 * This code is free software; you can redistribute it and/or modify it 27.10 @@ -529,7 +529,7 @@ 27.11 FreeIdSet::FreeIdSet(int sz, Monitor* mon) : 27.12 _sz(sz), _mon(mon), _hd(0), _waiters(0), _index(-1), _claimed(0) 27.13 { 27.14 - _ids = new int[sz]; 27.15 + _ids = NEW_C_HEAP_ARRAY(int, sz, mtInternal); 27.16 for (int i = 0; i < sz; i++) _ids[i] = i+1; 27.17 _ids[sz-1] = end_of_list; // end of list. 27.18 if (_stat_init) { 27.19 @@ -549,6 +549,7 @@ 27.20 27.21 FreeIdSet::~FreeIdSet() { 27.22 _sets[_index] = NULL; 27.23 + FREE_C_HEAP_ARRAY(int, _ids, mtInternal); 27.24 } 27.25 27.26 void FreeIdSet::set_safepoint(bool b) {
28.1 --- a/src/share/vm/utilities/workgroup.hpp Tue May 14 11:34:30 2013 +0400 28.2 +++ b/src/share/vm/utilities/workgroup.hpp Tue May 14 09:41:12 2013 -0700 28.3 @@ -1,5 +1,5 @@ 28.4 /* 28.5 - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 28.6 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 28.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.8 * 28.9 * This code is free software; you can redistribute it and/or modify it 28.10 @@ -494,7 +494,7 @@ 28.11 }; 28.12 28.13 // Represents a set of free small integer ids. 28.14 -class FreeIdSet { 28.15 +class FreeIdSet : public CHeapObj<mtInternal> { 28.16 enum { 28.17 end_of_list = -1, 28.18 claimed = -2