MemoryFreeze Fix

Say goodbye to Minecraft freezing up! This mod Cleans and Resets high RAM usage that causes Stutters and Slows Down your PC.

MemoryFreeze Fix

Release 2.0

Forge & Neoforge versions available !

A Minecraft Mod that Cleans Memory before it reaches 100% , therefore not causing any Stuttering when the allocated memory reaches It's limit.

Author: zSouul

What it does

  • Watches what the garbage collector really does: pause times, full GCs, and how much memory is still in use after a GC. If something is wrong it tells you, for example that your heap is too small.
  • Frees memory (a GC call) only when you won't notice: on loading screens, with no world loaded (title screen, world list), on the "loading terrain" screen, while the window is unfocused, or on a server with nobody online.
  • Turns on G1's periodic GC while the game runs (if your launcher hasn't), so old garbage gets cleaned up in the background when the game is paused or idle.
  • /memoryfreeze advice suggests launcher arguments based on numbers it measured on your machine.
  • /memoryfreeze diagnose writes a heap report grouped by mod, so you can see which mod is holding memory.

Requirements

  • Fabric Loader 0.19.3
  • Compatible Version of Fabric API Optional :
  • Compatible Version of Cloth Config API (for the config screen)

Commands

These exist on the server (trim, deepclean, diagnose, reload and hud need operator level 2) and on the client with the same names, so they work in singleplayer and on any server. The client versions only affect your own game.

Command What it does
/memoryfreeze status Health check result, GC overhead, longest pause, live data, last cleanup
/memoryfreeze advice Suggested launcher arguments for your machine
/memoryfreeze trim Cleans up now if the pause would be short, otherwise waits for the next safe moment
/memoryfreeze deepclean Cleans up right now, however long the pause is
/memoryfreeze diagnose Heap report grouped by mod, saved to a file
/memoryfreeze reset Client only. Leaves and rejoins the current world or server, which frees the memory the world was holding
/memoryfreeze reload Reloads the config file
/memoryfreeze hud Turns the on-screen meter on or off

There are also three keybinds (unbound by default) under Options > Controls > MemoryFreeze Fix: deep clean, full reset and heap report. They work on the title screen too.

Config

Use the config screen or edit config/memoryfreeze-fix.json. Values outside the allowed range are corrected when the file is loaded. A config from the old 1.x version is converted automatically and the old file is kept as memoryfreeze-fix.v1.json.bak.

Option Default What it does
autoCleanupEnabled true Allow automatic cleanups (safe moments only)
cleanupMinUsedPercent 50 Skip cleanups while the heap is emptier than this
cleanupMinReclaimMB 256 Skip cleanups unless the old generation grew this much since its lowest point after a GC
cleanupCooldownSeconds 120 Minimum time between automatic cleanups (it grows if cleanups free little)
safeMomentGraceMillis 1500 How long a safe moment has to last before a cleanup starts
cleanupOnPauseMenu false Also clean up in the pause menu. This can cause a small hitch, and the periodic GC already handles a paused game
cleanupWhenUnfocused true Also clean up while the window is unfocused or minimized
gameplayPauseBudgetMs 0 Advanced. Above 0, a cleanup may also run during gameplay if the heap is nearly full and the expected pause is no longer than this
gameplayPressurePercent 92 Heap percentage where the budget above applies
deepCleanMaxPasses 1 GC passes for a manual deep clean
runtimeTuningEnabled true Turn on G1's periodic GC while the game runs
g1PeriodicGcIntervalSeconds 15 Seconds without a GC before G1 starts a background cycle
healthAdviceEnabled true Show a chat message when the health check finds a problem
undersizedLivePercent 70 If more than this share of -Xmx is still live after a full GC, the heap is too small
longPauseMs 250 A GC pause at least this long counts as a long pause
autoDiagnoseEnabled true Write a heap report on its own (safe moments only) when the heap is too small or a leak is suspected
autoDiagnoseAfterSeconds 120 How long the problem has to last first
autoDiagnoseCooldownSeconds 900 Minimum time between automatic reports
pollIntervalMillis 1000 How often the watchdog checks things
hudEnabled false Show the memory meter in the top left
hudDetails true Also show GC overhead, longest pause and live data
chatNotifications true Show chat messages for important events. Results of commands you run are always shown
verboseChat false Also show a message for every automatic cleanup
logJvmAdviceOnStartup true Log launcher argument suggestions on startup if your setup looks off

Things to know

  • A mod can't do more than a GC call can. If a cleanup frees little, the memory is really in use, either by the world or by another mod. In that case use /memoryfreeze reset, give the game more memory, or look at what the heap report shows.
  • A forced GC stops the game under G1 whenever it runs. That is why automatic ones are limited to moments you won't notice. If you want almost no GC pauses at all, use Generational ZGC. That is a launcher setting, /memoryfreeze advice shows the flags for your Java version.
  • If your launcher passes -XX:+DisableExplicitGC, GC calls do nothing. The mod notices this and tells you.
  • The mod needs the jdk.management module for GC events and the runtime tuning. The Java runtimes that come with Minecraft have it. Without it the mod falls back to rough polling and skips the tuning.

MemoryFreeze Fix Team

profile avatar
Owner
  • 2
    Projects
  • 1.8K
    Downloads
Donate

More from zSouuul