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 commit is contained in:
Alexander Udalov
2015-03-24 16:40:42 +03:00
parent 30916e37ce
commit 58b033d9fb
3 changed files with 27 additions and 4 deletions
@@ -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();
}