Don't know if this still happens but, it appears to be a bug for a long time now there is a memory leak with the LaunchClassLoader.class. For newer versions it's probably still exists just under a rafractored name fix it. It's heavy on ram for no reason.
Java Class Loaders General: shouldn't be storing classes in memory. If you want to print transformed classes do so at the end of the transformers running not mass cache it.
Issue: LaunchClassLoader#resourceCache && LaunchClassLoader#cachedClasses both store classes in maps. One is obfuscated only and one is Transfomred class cache. This makes memory usage go way up for class loading. Load 1k classes by default it's now equal to 3k classes for additional libraries and mods this breaks anybody's ram The package is net.minecraft.launchwrapper
There is never a reason to keep the classes loaded into a map jvm keeps track of that. If you don't store the class files it will transform multiple times? No it doesn't I replaced the class and tested myself it only fires that class one time with no maps. Pure Java examples also specify nothing about storing your own class arrays. Anything you heard from that is confirmed false in java 8 and probably also java 7 and maybe java 6
Comments 4
without any mods this in vanilla it takes 100MB-200MB by itself no mods no forge.
now forge fixes this in 1.13 so I can't say for sure if it is still currently in vanilla this is mojang staff check your class loader remove maps if exist else close issue do nothing.
I could not reproduce the reported memory consumption. In my test the memory used by caching the classes was a few MB. Caching data in the way it's done in LaunchClassLoader is a technical requirement for the class loader to work in the intended way.
Apart from that, please do not report issues with the assumption that something is still the case in the most recent or in upcoming version based on observing something in an older version. If you report an issue for a version, make sure you tested that the reported behavior actually exists in that version. If your report starts with "Don't know if this still happens" or "For newer versions it's probably still exists" please reconsider sending it in the first place.
Can you provide some proof that "takes up gigs of ram for modpacks" is actually the case?
Well I wasn't able to view any source code past 1.12.2 since forge patched any asm issues for 1.13 glad to hear it's also patched on your end thanks close the issue
It would be your launch wrapper storing classes if it still exists LaunchClassLoader or something like that. JVM stores all classes in memory so you don't have to store them in maps it's actually a ram leak to keep a dupe arrays in there for classes and byte arrays. If you want to dump asm files you can dump it as the class goes into memory the first time not needing to store anything. Hopefully this is already fixed
this takes up gigs of ram for modpacks and megabytes of ram in vanilla for no good reason please fix this