MemGuard

MemGuard

Reduces RAM usage in large modpacks and servers by caching NBT strings, monitoring memory usage, and triggering garbage collection at optimal times.

by
8.7K Downloads
fabricforgeneoforgeoptimization
Rent Server with this Mod

About this Mod

MemGuard

Lean memory behavior for long Minecraft sessions.

MemGuard is a lightweight utility mod for Fabric / Forge / NeoForge (Minecraft 1.21.1) focused on reducing avoidable allocations and making memory pressure easier to observe.

What MemGuard does

1. Reuses repeated short NBT strings

  • Hook: NbtString.of(...)
  • Repeated short values are reused through an LRU cache (up to 2048 entries).
  • This reduces duplicate object allocations for common IDs/tags in larger modpacks.

2. Logs periodic heap snapshots

  • Heap usage is sampled from server tick context.
  • Warning logs are emitted when configured usage thresholds are exceeded.
  • Intended for visibility and troubleshooting, not as a direct performance claim.

3. Tracks texture-atlas lifecycle (client)

  • On atlas upload completion, MemGuard logs heap-used values in debug context.
  • This helps correlate load phases with memory behavior.

Technical notes

  • Uses mixin hooks for targeted behavior (NbtCacheMixin, ServerChunkManagerMixin / ChunkCacheMixin, TextureCacheMixin).
  • No native code, no unsafe memory access.
  • System.gc() is not used to force garbage collection.

Important accuracy notes

  • MemGuard does not guarantee fixed FPS/MSPT/MB improvements.
  • Real impact depends on modpack size, entity/world state, JVM vendor/flags, and session length.
  • Expected benefit is typically higher in medium/large packs with repeated NBT patterns.

Reproducible evaluation (recommended)

To evaluate MemGuard for your own setup, compare baseline vs. MemGuard under identical conditions:

  1. Same Java version, JVM args, mod list, world seed, and config.
  2. Same runtime window (recommended: 30-60 minutes per run).
  3. At least 3 baseline runs + 3 MemGuard runs.
  4. Collect comparable metrics:
  • p50/p95 MSPT (spark or similar)
  • heap usage trend from logs
  • allocation/GC event data (JFR or similar)
  1. Compare distributions (median/p95), not single spikes.

Installation

Fabric

  1. Install Fabric Loader (0.16+)
  2. Install Fabric API
  3. Place MemGuard jar in mods/

Forge / NeoForge

  1. Install the matching loader for your Minecraft version
  2. Place MemGuard jar in mods/

Compatibility

  • Designed to work alongside common optimization mods.
  • As with any mixin-based mod, test your exact modpack before production deployment.

Available Versions

MemGuard 1.0.4release
MC 1.21.1neoforge
June 3, 2026
MemGuard 1.0.2release
MC 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11fabric
April 5, 2026
MemGuard 1.0.2release
MC 1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11neoforge
April 5, 2026
MemGuard 1.0.3release
MC 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6forge
April 3, 2026

How to Install MemGuard on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set fabric Loader

In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21.11).

3

Install Mod

Open the mod browser in the dashboard and search for "MemGuard". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

fabricforgeneoforge

Minecraft Versions

1.21.11, 1.21.10, 1.21.9 (+16 more)

Server-side

Required

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

MemGuard server crashes on startup – what to do?

Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.11). You can switch loaders with one click in the panel.

Is MemGuard compatible with fabric and forge and neoforge?

MemGuard officially supports fabric, forge, neoforge for Minecraft 1.21.11, 1.21.10, 1.21.9. Note: Forge and Fabric mods are NOT cross-compatible – pick one loader and stick with it. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with MemGuard – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if MemGuard consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install MemGuard with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
LicenseRef-All-Rights-Reserved
Server-side
Required

Supported Versions

1.21.111.21.101.21.91.21.81.21.71.21.61.21.51.21.41.21.31.21.2+9 more