Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Making the subgame more lightweight

Dorian Wouters edited this page May 5, 2016 · 25 revisions

Currently, MFF uses a pretty big amount of RAM, often causing bad alloc exceptions, especially on Windows.

This prevents many players from joining the server and playing with us.

The goal is to reduce MFF's RAM consumption by determining each mod's memory usage. This is achieved by measuring the memory usage delta between a world loaded with and without a specific mod (and mods depending on it): first, create a dummy world, preferably non-empty (either singlenode with watershed enabled, or any of the default mapgens), then enable all MFF mods on it (to the exception of watershed if not required and the irc(_commands) mod which can fail since it loads a binary module). Load the world and let it generate terrain around you. Then, follow these steps (Linux/BSD/OSX only):

  1. Launch Minetest, and configure the mods to be loaded or not.
  2. Restart Minetest, load the world, don't move and wait for the map to be fully loaded.
  3. Get memory usage info using the command line: cat /proc/$(ps --no-headers -C minetest -o pid | xargs)/status | grep Vm
  4. Close Minetest

Its output looks like this:

VmPeak:  1506180 kB
VmSize:  1478828 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:    427572 kB
VmRSS:    427572 kB
VmData:  1084712 kB
VmStk:       152 kB
VmExe:      6236 kB
VmLib:     40084 kB
VmPTE:      1480 kB
VmPMD:        20 kB
VmSwap:        0 kB

The interesting line is VmSize, which tells actual memory usage. Run those steps for different mod configurations, then do your usual math to determine how much a mod eats memory.

Please note disabling a mod also disables mod that have a hard dependency on it. They should be listed between parentheses.

Disabled mod MT version MFF Commit RAM usage
u_skins d82c5da b40a199 72968 kB = 73 MB!
stained_glass 033a510 b40a199 10152 kB = 10 MB
colouredstonebricks 033a510 b40a199 48388 kB = 48 MB
moreblocks (colouredstonebricks, stained_glass) 033a510 b40a199 794016 kB = 794 MB!!!
homedecor_modpack 033a510 b40a199 331648 kB = 332 MB!
mesecons 033a510 b40a199 167884 kB = 168 MB
jukebox 033a510 b40a199 67968 kB = 68 MB
ambience 033a510 b40a199 20220 kB = 20 MB
plantlife_modpack 033a510 b40a199 18424 kB = 18 MB
nether 033a510 b40a199 9632 kB = 10 MB
mobs 033a510 b40a199 55764 kB = 55 MB
plantlife_modpack b30e8d8 b061ea6 15632 kB = 16 MB
sea b30e8d8 b061ea6 6480 kB = 6.5 MB
WorldEdit Near-zero

033a510 b40a199

Old results

Disabled mod MT version MFF Commit RAM usage
homedecor_modpack b30e8d8 b061ea6 134816 kB = 135 MB !
mesecons b30e8d8 b061ea6 173776 kB = 174 MB !
mesecons_noteblock b30e8d8 471915c 20104 kB = 20 MB
jukebox b30e8d8 b061ea6 51536 kB = 52 MB
mobs b30e8d8 b061ea6 33020 kB = 33 MB
ambience b30e8d8 471915c 19928 kB = 20 MB
ambience b30e8d8 b061ea6 953684 kB = 954 MB !!!
Clone this wiki locally