Contains executable files or external scripts. Ensure you trust the creator and apply your own security measures.
V3.0:
V2.0:Rewritten the switching logic, accurately determined the true state of the GC switch, and optimized the upper limit setting of Heap Size
Overview
Native GC Patcher is a high-performance Anti-Stutter & GC Manager for Virt-A-Mate (VaM). It interacts directly with the game's Mono runtime to control Garbage Collection (GC), eliminating micro-stutters caused by frequent GC spikes and preventing memory overflows during long sessions.
This plugin can only control the timing of GC operation and cannot clean up the memory usage of VAM.
Unlike standard script-based cleaners, this plugin runs natively via BepInEx, allowing it to "Lock" the GC when memory is safe (ensuring smooth framerates) and "Force Clean" intelligently when necessary.
Heap Size & RAM
Key Features
Zero-Stutter Mode (GC Locking)
The plugin locks the Mono Garbage Collector to prevent it from running randomly during gameplay, which is the main cause of periodic lag spikes in VaM.
GC is only allowed to run when memory usage hits your defined limit.
Smart Auto-Triggers
On Scene Load: Automatically performs a deep clean right after a scene finishes loading.
On Person Removed: Automatically cleans up memory when you delete a character, preventing "ghost" data from clogging your RAM.
Includes "Debounce" technology: If you delete multiple characters quickly, it waits until you are done before cleaning.
Smart RAM Detection
On first launch (or hardware change), the plugin detects your total System RAM and automatically sets a safe Memory Limit (defaulting to ~50% of your total RAM).
Requirements
Virt-A-Mate (v1.20 or newer recommended)
BepInEx 5.x (x64) installed in your VaM folder.
Installation
Ensure you have BepInEx installed. (If you see a BepInEx folder in your VaM root directory, you are good to go).
Copy the NativeGCPatcher.dll file into: .../Virt-A-Mate/BepInEx/plugins/
Start the game. You should see a status overlay in the top-left corner.
Controls & Usage
Ctrl + G: Toggle the Settings Window.
Ctrl + F: Toggle the GC Statu.
Enable Plugin : Turns the entire logic on/off.
Memory Limit (GB) :
The Min value is set to 4GB, and the Max value is Capped at 50% of your Total RAM.
The threshold where GC is allowed to run. If usage is below this, GC is locked for smoothness.
GC On Scene Load : Triggers a cleanup immediately after a scene loads. Highly recommended.
GC On Person Removed : Triggers a cleanup when a Person atom is destroyed.
Show Overlay : Displays the mini status info in the top-left corner.
Configuration
You can edit settings via the in-game window (Ctrl+G) or by editing the config file at:
.../Virt-A-Mate/BepInEx/config/com.yours.gcpatcher.cfg
FAQ
Q: Why does delaying GC increase Heap Size?
A: Think of Unity's memory as a parking lot.
Q: Why does the game freeze for a second sometimes?
A: That is the "Force GC" kicking in. It freezes the game briefly to reclaim memory. This is intentional and happens only when you hit your Memory Limit or trigger an event (like loading a scene), preventing random stutters during gameplay.
Q: My Memory Limit changed automatically?
A: The plugin detected a change in your system hardware (e.g., you upgraded RAM or moved to a new PC) and auto-adjusted the limit to a safe value.
- Use an offset-based approach instead of feature flags to retrieve GC_disable.
- Limit the maximum heap size to 20 GB. VAM’s Unity/Mono “stability sweet spot” is around 12–16 GB; once the managed heap exceeds ~18–20 GB, Mono’s management overhead becomes extremely high and it’s prone to “Too many heap sections!” errors.
- If you’re using CPU Performance Patch v13, the plugin will not work!!! Please use v12.
V2.0:Rewritten the switching logic, accurately determined the true state of the GC switch, and optimized the upper limit setting of Heap Size
Overview
Native GC Patcher is a high-performance Anti-Stutter & GC Manager for Virt-A-Mate (VaM). It interacts directly with the game's Mono runtime to control Garbage Collection (GC), eliminating micro-stutters caused by frequent GC spikes and preventing memory overflows during long sessions.
This plugin can only control the timing of GC operation and cannot clean up the memory usage of VAM.
Unlike standard script-based cleaners, this plugin runs natively via BepInEx, allowing it to "Lock" the GC when memory is safe (ensuring smooth framerates) and "Force Clean" intelligently when necessary.
Heap Size & RAM
| Feature | Heap Size (Managed Heap) | RAM (Physical Memory / Total Reserved) |
| Definition | Memory reserved specifically for C# script objects by the Unity/Mono runtime. | The total memory allocated by the VAM process from the OS. |
| Relationship | It is a small subset of RAM. | Includes the Heap, plus native assets like textures, meshes, and audio. |
| Content | • List, Dictionary • JSONStorable (VAM Params) • Strings, Plugin variables | • Heap Size (Included) • Textures (Largest consumer) • Meshes (Geometry) • Audio data |
| Manager | Garbage Collector (GC). Automatically scans and clears unreferenced variables. | Unity Engine Core + OS. Native assets are ignored by GC and must be unloaded manually. |
| Performance | Causes Stutter / Lag. When Heap is full or fragmented, GC pauses the game to clean up. | Causes Crash (CTD). When RAM is exhausted, the OS kills the process. |
Key Features
Zero-Stutter Mode (GC Locking)
The plugin locks the Mono Garbage Collector to prevent it from running randomly during gameplay, which is the main cause of periodic lag spikes in VaM.
GC is only allowed to run when memory usage hits your defined limit.
Smart Auto-Triggers
On Scene Load: Automatically performs a deep clean right after a scene finishes loading.
On Person Removed: Automatically cleans up memory when you delete a character, preventing "ghost" data from clogging your RAM.
Includes "Debounce" technology: If you delete multiple characters quickly, it waits until you are done before cleaning.
Smart RAM Detection
On first launch (or hardware change), the plugin detects your total System RAM and automatically sets a safe Memory Limit (defaulting to ~50% of your total RAM).
Requirements
Virt-A-Mate (v1.20 or newer recommended)
BepInEx 5.x (x64) installed in your VaM folder.
Installation
Ensure you have BepInEx installed. (If you see a BepInEx folder in your VaM root directory, you are good to go).
Copy the NativeGCPatcher.dll file into: .../Virt-A-Mate/BepInEx/plugins/
Start the game. You should see a status overlay in the top-left corner.
Controls & Usage
Ctrl + G: Toggle the Settings Window.
Ctrl + F: Toggle the GC Statu.
Enable Plugin : Turns the entire logic on/off.
Memory Limit (GB) :
The Min value is set to 4GB, and the Max value is Capped at 50% of your Total RAM.
The threshold where GC is allowed to run. If usage is below this, GC is locked for smoothness.
GC On Scene Load : Triggers a cleanup immediately after a scene loads. Highly recommended.
GC On Person Removed : Triggers a cleanup when a Person atom is destroyed.
Show Overlay : Displays the mini status info in the top-left corner.
Configuration
You can edit settings via the in-game window (Ctrl+G) or by editing the config file at:
.../Virt-A-Mate/BepInEx/config/com.yours.gcpatcher.cfg
FAQ
Q: Why does delaying GC increase Heap Size?
A: Think of Unity's memory as a parking lot.
- Default Mode (Frequent GC):As soon as a car leaves (becomes garbage), GC immediately frees up that spot. New cars can park in these recycled spots.
- Result: The parking lot stays small and efficient.
- Plugin Mode (Delayed GC):To prevent lag stutters, we lock the GC. This means even if data is garbage, it still "occupies" the spot. When new data arrives, it can't fit in the old spots, so the system is forced to expand the parking lot(allocate more RAM) to fit the new data.
- Result: Even after a cleanup, the parking lot (Heap Size) remains permanently expanded.
Q: Why does the game freeze for a second sometimes?
A: That is the "Force GC" kicking in. It freezes the game briefly to reclaim memory. This is intentional and happens only when you hit your Memory Limit or trigger an event (like loading a scene), preventing random stutters during gameplay.
Q: My Memory Limit changed automatically?
A: The plugin detected a change in your system hardware (e.g., you upgraded RAM or moved to a new PC) and auto-adjusted the limit to a safe value.
Contains executable files or external scripts. Ensure you trust the creator and apply your own security measures.