< prev index next >

test/jdk/java/lang/ref/OOMEInReferenceHandler.java

Print this page
*** 80,10 ***
--- 80,12 ---
  
           ReferenceQueue<Object> refQueue = new ReferenceQueue<>();
           Object referent = new Object();
           WeakReference<Object> weakRef = new WeakReference<>(referent, refQueue);
  
+          // Allow thread.sleep() to pre-allocate ThreadSleepEvent object
+          Thread.sleep(1L);
           Object waste = fillHeap();
  
           referenceHandlerThread.interrupt();
  
           // allow referenceHandlerThread some time to throw OOME
< prev index next >