< prev index next >

src/share/vm/memory/allocation.cpp

Print this page
rev 9067 : 8139040: Fix initializations before ShouldNotReachHere()

@@ -64,11 +64,11 @@
 void MetaspaceObj::print_address_on(outputStream* st) const {
   st->print(" {" INTPTR_FORMAT "}", p2i(this));
 }
 
 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() {
-  address res;
+  address res = NULL;
   switch (type) {
    case C_HEAP:
     res = (address)AllocateHeap(size, flags, CALLER_PC);
     DEBUG_ONLY(set_allocation_type(res, C_HEAP);)
     break;

@@ -86,12 +86,12 @@
   return (address) operator new(size, type, flags);
 }
 
 void* ResourceObj::operator new(size_t size, const std::nothrow_t&  nothrow_constant,
     allocation_type type, MEMFLAGS flags) throw() {
-  //should only call this with std::nothrow, use other operator new() otherwise
-  address res;
+  // should only call this with std::nothrow, use other operator new() otherwise
+  address res = NULL;
   switch (type) {
    case C_HEAP:
     res = (address)AllocateHeap(size, flags, CALLER_PC, AllocFailStrategy::RETURN_NULL);
     DEBUG_ONLY(if (res!= NULL) set_allocation_type(res, C_HEAP);)
     break;
< prev index next >