Fix byte array memory leak from MemoryBasedClassLoader
40 Mb of bytes of preloaded compiler classes during the compilation become 16 Mb after this change This is a slightly reworked version of58b033d(reverted in3f05419). The problem in that commit was that URLClassLoader did not work in the fashion MemoryBasedClassLoader was designed to work (child first, parent last). So some resource was found in an incorrect jar which was causing the compiler to break
This commit is contained in:
@@ -135,7 +135,11 @@ public class PathUtil {
|
||||
|
||||
@NotNull
|
||||
public static File getResourcePathForClass(@NotNull Class aClass) {
|
||||
String resourceRoot = PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
|
||||
String path = "/" + aClass.getName().replace('.', '/') + ".class";
|
||||
String resourceRoot = PathManager.getResourceRoot(aClass, path);
|
||||
if (resourceRoot == null) {
|
||||
throw new IllegalStateException("Resource not found: " + path);
|
||||
}
|
||||
return new File(resourceRoot).getAbsoluteFile();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user