@@ -0,0 +1,1914 @@
+package org.apache.markt.leaks.concurrent;%0A%0Aimport java.util.concurrent.ForkJoinPool;%0Aimport java.util.concurrent.RecursiveAction;%0A%0Aimport org.apache.markt.leaks.LeakBase;%0A%0A/**%0A * Java 5 - ForkJoin not supported%0A * Java 6 - ForkJoin not supported%0A * Java 7 - no leak%0A * Java 8 - no leak%0A */%0Apublic class ForkJoinThreadLeak extends LeakBase %7B%0A%0A    private static ForkJoinPool commonPool;%0A%0A    public static void main(String%5B%5D args) %7B%0A        // This doesn't help. While InnocuousForkJoinWorkerThread instances do%0A        // return the system class loader for calls to getContextClassLoader()%0A        // they don't ever set the field in the super class so%0A        // Thread.contextClassLoader retains the reference to the original class%0A        // loader thereby creating the leak.%0A        //%0A        // System.setProperty(%22java.util.concurrent.ForkJoinPool.common.threadFactory%22,%0A        //        %22java.util.concurrent.ForkJoinPool$InnocuousForkJoinWorkerThreadFactory%22);%0A%0A        commonPool = new ForkJoinPool();%0A%0A        ForkJoinThreadLeak forkJoinThreadLeak = new ForkJoinThreadLeak();%0A        forkJoinThreadLeak.doLeakTest();%0A    %7D%0A%0A%0A    @Override%0A    protected void createLeakingObjects() %7B%0A        commonPool.invoke(new NoopAction(5));%0A    %7D%0A%0A%0A    @Override%0A    protected void cleanUpLeakingObjects() %7B%0A        // None%0A    %7D%0A%0A    private class NoopAction extends RecursiveAction %7B%0A%0A        private static final long serialVersionUID = 1L;%0A%0A        final int count;%0A%0A        public NoopAction(int count) %7B%0A            this.count = count;%0A        %7D%0A%0A        @Override%0A        protected void compute() %7B%0A            if (count %3E 1) %7B%0A                int mid = count / 2;%0A                NoopAction left = new NoopAction(mid);%0A                NoopAction right = new NoopAction(count - mid);%0A                left.fork();%0A                right.compute();%0A                left.join();%0A            %7D%0A        %7D%0A    %7D%0A%7D

Add test case for ForkJoin memory leak