MultiMC / Launcher

A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once
https://multimc.org/
Other
4.29k stars 877 forks source link

Assigning large directories for icons causes memory bloat #2317

Open Curunir opened 6 years ago

Curunir commented 6 years ago

System Information

MultiMC version: 0.6.2-1137 on lin64 Operating System: Linux Mint 19 Tara Cinnamon (beta version) Linux kernel 4.15.0-23 Intel Core i5-3570K@3.4Ghz 16GiB of DDR3 Java: openjdk8-jre update 171 64bit

Summary of the issue or suggestion:

MultiMC allocates humongous amounts of memory for itself, independently of and in addition to what modpacks use, if big directories are given for icons and mods. It goes from approximately 11MiB to over 4GiB of memory usage in my case.

What should happen:

MultiMC should probably parse and index the given directories, but not allocate gigabytes of memory for doing so.

Steps to reproduce the issue (Add more if needed):

  1. Install MultiMC Linux on Mint 19 Cinnamon (or any other flavour, presumably - it just never occurred to me before to point it to these directories via menu).

  2. Give it a big /Picture directory in the "icons" field. As soon as you save the directory choices, observe how its memory usage spikes enormously. The program also pretty much freezes while it is busy with that. It continues to work normally afterwards, just with a huge lump of memory being blocked for no good reason. In my case it was 4.6GiB. See linked screenshot gallery for details.

Suspected cause:

Some bad design decisions or non-optimal OS methods being used to parse the files in those directories.

Logs/Screenshots:

https://imgur.com/a/vEx7G81

Additional Info:

This happened after a fresh installation of Mint 19, alongside a fresh MultiMC installation where I copied over my instances, coming from Mint 18.3.

Curunir commented 6 years ago

I cross-checked and it's actually just the /Pictures directory for icons that does it. Must be loading the entire contents into memory when it's assigned.

peterix commented 6 years ago

I do not consider this to be a bug... Don't use huge images as icons, it won't use the memory.

peterix commented 6 years ago

That said, I have no better label for it :D

Needs some changes to when/how icons are loaded... But you have a workaround: don't give it tons of huge images.

Curunir commented 6 years ago

I figured as much, just found that this happens. People will do stupid things like that, so better build some protection against it - like ignoring pictures above a certain size or number, or something along those lines.