Community listing page, reviews may not be monitored by the author.
MemGuard
No reviews yet
Reduces RAM usage in large modpacks and servers by deduplicating NBT strings and monitoring memory usage, without forced GC freezes.
Community voices
Reviews
No reviews yet. Be the first to review this project!
Get it on
Available Platforms
Compatibility
Supported Environments
Must be installed on both the client and the server.
Install on the client or the server; either alone gives full functionality.
Varies by version.
About
Project Details
For authors
Embed Badge
If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.
Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.
Identifiers
Platform IDs
Resources
External Links
About
Description
MemGuard
Lightweight memory helper for modded Minecraft.
Deduplicates repeated NBT strings and keeps an eye on your heap — without ever freezing your game.
🆕 Forge v1.0.5 — no more lag spikes
Older Forge builds (1.0.3 and earlier) forced a full garbage collection every 5 minutes and after every texture atlas upload. In big modpacks that meant a short freeze every few minutes. Version 1.0.5 removes every forced GC: tested in a 364-mod pack, the 609 ms freeze every 5 minutes is gone. If you use MemGuard on Forge, please update.
What MemGuard Does
| Feature | Description |
|---|---|
| NBT String Dedup | Short, repeated NBT strings (item ids, keys, enum names) share one instance instead of being stored thousands of times. Lock-free and size-limited, so it never slows other threads down. |
| Memory Monitor | Writes a short memory status to the log and warns when heap usage gets risky, so you know when a pack needs more RAM or a lower view distance. |
| No Forced GC | MemGuard never calls System.gc(). The JVM's own garbage collector already runs at the right moments. |
MemGuard is a helper, not a miracle: it does not promise specific FPS, MSPT or RAM numbers. For memory leaks, pair it with mods like AllTheLeaks or FerriteCore.
Supported Versions
| Loader | Minecraft | Java | Latest build |
|---|---|---|---|
| Forge | 1.20 – 1.20.6 | 17+ | v1.0.5 |
| NeoForge | 1.21.x | 21+ | v1.0.4 |
| Fabric | 1.21.x | 21+ | v1.0.1 (update with the same fix coming soon) |
Check the Files tab for the exact build per version.
Compatibility Notes
- Works alongside FerriteCore and AllTheLeaks.
- Safe to run with
-XX:+DisableExplicitGC(common in server packs). - If logs mention missing Create classes, check that Create and its addons are on the same update line (Update 5 with Update 5 addons, Update 6 with Update 6 addons). That is not caused by MemGuard.
Quick Install
- Install the loader for your Minecraft version.
- Put the MemGuard jar for your loader in the
modsfolder. - Start the game and look for
[MemGuard]lines inlatest.log.
Support the Project
If MemGuard helps your pack, consider leaving a tip — it keeps the coffee ☕ flowing and the fixes coming!
Found a problem? Leave a comment with your latest.log — every report helps. 💙
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:
- Same Java version, JVM args, mod list, world seed, and config.
- Same runtime window (recommended: 30-60 minutes per run).
- At least 3 baseline runs + 3 MemGuard runs.
- Collect comparable metrics:
- p50/p95 MSPT (
sparkor similar) - heap usage trend from logs
- allocation/GC event data (JFR or similar)
- Compare distributions (median/p95), not single spikes.
Installation
Fabric
- Install Fabric Loader (
0.16+) - Install Fabric API
- Place MemGuard jar in
mods/
Forge / NeoForge
- Install the matching loader for your Minecraft version
- 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.
Screenshots
Gallery
Versions
Files
Relations
Project Relations
More like this
Similar Mods
Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.
On ModDex
Community snapshot
By the numbers
Statistics
Get it on
Available Platforms
On ModDex
Community snapshot
By the numbers
Statistics
Resources