< prev index next >

src/hotspot/share/memory/allocation.cpp

Print this page
@@ -85,10 +85,18 @@
    assert(!Thread::current()->is_Java_thread(), "only allowed by non-Java thread");
    assert(type != ClassType, "class has its own operator new");
    return Metaspace::allocate(loader_data, word_size, type, /*use_class_space*/ false);
  }
  
+ 
+ // Work-around -- see JDK-8331086
+ void* MetaspaceObj::operator new(size_t size, MemTag flags) throw() {
+   void* p = AllocateHeap(size, flags, CALLER_PC);
+   memset(p, 0, size);
+   return p;
+ }
+ 
  bool MetaspaceObj::is_valid(const MetaspaceObj* p) {
    // Weed out obvious bogus values first without traversing metaspace
    if ((size_t)p < os::min_page_size()) {
      return false;
    } else if (!is_aligned((address)p, sizeof(MetaWord))) {
< prev index next >