Last active
March 4, 2016 17:14
-
-
Save eerohele/4fd2831db93d4ff072a7 to your computer and use it in GitHub Desktop.
Gradle DefaultIsolatedAntBuilder PermGen Leak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enable the Gradle daemon and run this until failure: | |
// while gradle --rerun-tasks; do :; done | |
import org.gradle.api.internal.ClassPathRegistry | |
import org.gradle.api.internal.DefaultClassPathProvider | |
import org.gradle.api.internal.DefaultClassPathRegistry | |
import org.gradle.api.internal.classpath.DefaultModuleRegistry | |
import org.gradle.api.internal.classpath.ModuleRegistry | |
import org.gradle.api.internal.project.antbuilder.DefaultIsolatedAntBuilder | |
import org.gradle.internal.classloader.DefaultClassLoaderFactory | |
ModuleRegistry moduleRegistry = new DefaultModuleRegistry() | |
ClassPathRegistry registry = new DefaultClassPathRegistry(new DefaultClassPathProvider(moduleRegistry)) | |
DefaultIsolatedAntBuilder antBuilder = new DefaultIsolatedAntBuilder(registry, new DefaultClassLoaderFactory()) | |
defaultTasks 'test' | |
antBuilder.execute { | |
// Can be any JAR file | |
antProject.getClass().classLoader.addURL(new File('/opt/dita-ot/lib/xml-resolver-1.2.jar').toURL()) | |
} | |
task test { | |
antBuilder.execute { | |
echo('hello world') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment