private void forceGarbageCollection() throws Exception {
        // Fill up memory
        SoftReference ref = new SoftReference(new Object());
        int count = 0;
        while(ref.get() != null && count++ < 5) {
            java.util.ArrayList list = new java.util.ArrayList();
            try {
                long i = 0;
                while (true && ref.get() != null) {
                    list.add("A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String A Big String " + (i++));
                }
            } catch (Throwable ignored) {
            }
            list.clear();
            list = null;
            // System.out.println("Count " + count + " : " + getMemoryStats());
            System.gc(); 
            Thread.sleep(1000);
        }
        // System.out.println("After GC: " + getMemoryStats());
        
        if (ref.get() != null) {
            throw new IllegalStateException("Your JVM is not releasing SoftReference, try running the testcase with less memory (-Xmx)");
        }
    }