MinecraftMachina / ManyMC

📦 A familiar Minecraft Launcher with native support for macOS arm64 (M1)
GNU General Public License v3.0
500 stars 19 forks source link

Not just a ManyMC issue - weird stuttering with modpackt #77

Closed Bexin3 closed 2 years ago

Bexin3 commented 2 years ago

This isn't something exclusive to manymc but to apple silicone in general, but sometimes there is a huge fps drop to like 1 fps every few seconds on older versions when using mods, it would be nice if it was possible to find a workaround to be implemented here

ViRb3 commented 2 years ago

Your request lacks any specific information, so even if I wanted, I would have no way to help. Anyway, support for individual mods will never be provided due to the sheer scale that this involves. If there's a specific issue present in Apple Silicon and not Intel, and you can pin this down to something within Minecraft's core and not simply poor code by the mod author, only then we can possibly start looking into it.

Bexin3 commented 2 years ago

Sorry for less details, I am looking into why exactly this happens but it happens with different modpacks and most likely because of m1, I managed to track it down to happening every time memory gets freed, sometimes when memory usage decreases no new frame gets rendered even for 3 seconds

Bexin3 commented 2 years ago

I have just managed to confirm this is not exclusive to any mods or modpack, vanilla doesn't use enough vanilla for this to be clearly visible but any few mods can have this behaviour on any version. There is nothing in the logs but using alt + f3 its clearly visible frame times always get high when memory gets freed up. More memory that gets freed up longer the frame time is. Using optifine and setting render distance to maximum also makes this more clearly visible

Bexin3 commented 2 years ago

Not an issue with ManyMC but haven't heard of this happening on non m1 devices so it would be great if it was somehow fixable though I doubt it is

ViRb3 commented 2 years ago

This is perhaps the most common Minecraft issue on every single device, it is not M1 exclusive. Yes, the more mods you have, the more pronounced it will be. And also, the less RAM you have, the more it will be pronounced.

Try using optimized JVM arguments:

-XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M

Also try allocating more RAM. Note that macOS allows you to allocate more RAM than you physically have, and if you exceed your physical capacity, you will start swapping to disk, which will definitely result in stuttering. Remember that M1 has unified memory between RAM and GPU, so you can't just allocate all your RAM, some will be always used by GPU. If you have a low-memory M1 unit, this is likely your cause. For me with M1 Max and 32GB RAM, I can promise I get no such stuttering.

Bexin3 commented 2 years ago

Any way to alocate more ram then I have on ManyMC? Even on MultiMC it would never allow me to go past 16GB which is how much ram I have. Same on ManyMC, doesn't let me locate virtual memory.

ViRb3 commented 2 years ago

If you have 16GB RAM on your Mac, allocate 8GB to your modpack. As I said, if you allocate too much and start swapping, stuttering is guaranteed to occur. You do not want that. Also make sure you actually have 8GB free and not used by other applications.

Bexin3 commented 2 years ago

Thanks, the arguments make it a bit better. Still its kinda weird, I don't remember having as much stuttering on any of my previous devices. Here it still takes half a second to render a frame when memory stuff happens

ViRb3 commented 2 years ago

Most likely your device is swapping. Google a bit on it and check whether that's the case. I can't provide support for this, but you should be able to get the game working smoothly with 16GB of RAM.