comparison src/share/vm/memory/memRegion.cpp @ 10271:f9be75d21404

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
author minqi
date Tue, 14 May 2013 09:41:12 -0700
parents f95d63e2154a
children 9758d9f36299
comparison
equal deleted inserted replaced
10269:a9270d9ecb13 10271:f9be75d21404
21 * questions. 21 * questions.
22 * 22 *
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "memory/allocation.hpp"
27 #include "memory/allocation.inline.hpp"
26 #include "memory/memRegion.hpp" 28 #include "memory/memRegion.hpp"
27 #include "runtime/globals.hpp" 29 #include "runtime/globals.hpp"
28 30
29 // A very simple data structure representing a contigous word-aligned 31 // A very simple data structure representing a contigous word-aligned
30 // region of address space. 32 // region of address space.
97 return MemRegion(); 99 return MemRegion();
98 } 100 }
99 ShouldNotReachHere(); 101 ShouldNotReachHere();
100 return MemRegion(); 102 return MemRegion();
101 } 103 }
104
105 void* MemRegion::operator new(size_t size) {
106 return (address)AllocateHeap(size, mtGC, 0, AllocFailStrategy::RETURN_NULL);
107 }
108
109 void* MemRegion::operator new [](size_t size) {
110 return (address)AllocateHeap(size, mtGC, 0, AllocFailStrategy::RETURN_NULL);
111 }
112 void MemRegion::operator delete(void* p) {
113 FreeHeap(p, mtGC);
114 }
115
116 void MemRegion::operator delete [](void* p) {
117 FreeHeap(p, mtGC);
118 }
119