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

Making the subgame more lightweight

Ombridride edited this page Aug 17, 2015 · 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)/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 you 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
mobs b30e8d8 b061ea6 33020 kB = 33 MB
OLD ambience b30e8d8 b061ea6 953684 kB = 954 MB !!! (need to be re-checked since the last update of this mod)
ambience b30e8d8 471915c 19928 kB = 20 MB
jukebox b30e8d8 b061ea6 51536 kB = 52 MB
mesecons b30e8d8 b061ea6 173776 kB = 174 MB !
mesecons_noteblock b30e8d8 471915c 20104 kB = 20 MB
plantlife_modpack b30e8d8 b061ea6 15632 kB = 16 MB
sea b30e8d8 b061ea6 6480 kB = 6.5 MB
homedecor_modpack b30e8d8 b061ea6 134816 kB = 135 MB !
WorldEdit Near-zero
Clone this wiki locally