Skip to content

MPHONlC/Auto-Lua-Memory-Cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 

ESOUI Bethesda Mods

A lightweight, event-driven background memory cleaner designed to help clear out background memory junk during natural breaks.

Optional Dependencies: This addon requires the following optional libraries:

Without the Dependencies: You can still run the addon entirely independent, and control its settings via built-in slash commands as a standalone utility.


WHY USE THIS OVER OTHER MEMORY CLEANERS?

Other memory cleaners use constant "OnUpdate" timers that ping the game every few seconds to check your memory. The timer loops endlessly from the moment you log in. They do often pause the cleanup, but the polling loop keeps firing in the background even during fights. They also often calculate memory strings even when the UI is hidden or closed, are built before console APIs existed, and only track "collectgarbage" (ignoring console UI limits), all of which unnecessarily wastes CPU cycles.

Auto Lua Memory Cleaner uses a dormant, event-driven trigger. It stays completely asleep (using 0% CPU) and only wakes up to check your memory during natural breaks while playing, such as right after you exit combat or while inside a menu.

Auto Lua Memory Cleaner UI 1
Auto Lua Memory Cleaner UI 2

FEATURES

  • Zero Idle Footprint : Event trigger ensures the addon only runs checks during loading screens, exiting combat state, or while inside a menu. All graph modules, diagnostics, and trackers are strictly dormant and default to OFF.
  • Smart Combat Lockout : Will never force a garbage collection cycle while you are in combat or dead, preventing dangerous mid-fight frame drops (Imagine crashing in the middle of your Trifecta, or God Slayer run!).
  • PC & Console Support : Automatically adapts to your hardware specific memory rules. On PC, it helps you stay safely below the 512MB performance "soft limit" to prevent UI lag and stuttering. On Console, it safely monitors the strict 100MB hardware memory pool.
  • Double-Pass Engine Sweep : A dual-pass garbage collection cycle to safely force execution of all pending __gc hooks and ensure orphaned weak tables are properly eradicated from the shared memory pool.
  • PermMemento Integration : Automatically detects Permanent Memento and disables its internal ALC cleaner.
  • Script Profiler Module : Built-in performance scanner that profiles all active addons over a 60-second (PC) or 30-second (Console) window to identify which ones are causing the highest performance spikes.

ADVANCED PROFILER & TRACKING

  • Dynamic Visual Graph : A detachable, btop inspired module provides a real-time, 15 second window into your system performance. Updating every 250ms, the glowing LED style line dynamically color shifts as you approach your memory threshold for intuitive, at-a-glance monitoring.
  • Lite Mode : This toggle hides the visual graph, leaving you with a clean, text only diagnostic overlay that provides all your vital data.
  • Stable Baseline Math : Analyzes your connection and framerate over 60-second intervals to calculate "FPS Loss" and "Ping Spikes".
  • Previous Session Tracker : A detachable UI that saves performance data every time you log out or reload your UI. Can track session Peak (Red), Average (Orange), Final/Last-Seen Values (White), and total MemCleaned per session (Cyan).

Legend (Symbol Key): < Less than (under) | <= Less than or equal to (maximum) | > Greater than (over) | >= Greater than or equal to (at least) | + And above (e.g., 500+ means 500 or more)

  • Diagnostics Tracking : Track real-time Ping, FPS, Frametime (ms), and KB/MB memory creep. Text dynamically color-shifts by load:
    • FPS (Current & Avg): >=50 Green | 30-49 Orange | <30 Red
    • FPS Loss (Spikes): 0-5 Green | 6-15 Orange | 16+ Red
    • Latency (ms): 0-250 Yellow | 251-375 Deep Pink | 376+ Violet
    • Frametime: <=20ms Dodger Blue | >20ms Cyan
    • Total Memory (PC/Mac): <320MB Green | 320-511MB Orange | 512MB+ Red
    • Total Memory (Console): <60MB Green | 60-99MB Orange | 100MB+ Red
    • Avg KB / MB Gains: KB is static Magenta. MB matches your Total Memory color.
  • Profiler Scan Severity Scale : Built-in script profiler dynamically colors scanned addons based on their actual millisecond execution time to help identify lag:
    • [Top] Severe Load (500+ ms): Red
    • [High] Noticeable Load (100 ms to 499 ms): Orange
    • [Moderate] Moderate Load (20 ms to 99 ms): Yellow
    • [Low] Normal Load (5 ms to 19 ms): Green
    • [Very Low] Fast Execution Load (1 ms to 4 ms): White
    • [Bottom] Negligible Load (< 1 ms): Gray

USAGE & SETTINGS

  • AUTO-CLEANUP : Runs silently based on your thresholds.
  • REPEAT DELAY : Configure how long the addon waits to attempt again.
  • TRACK STATISTICS : Toggle to enable lifetime tracking (Cleanups triggered, total MB freed).
  • SCREEN ANNOUNCEMENTS : Defaulted ON to show memory freed.
  • FORCE MANUAL CLEANUP : Instantly wipes unused Lua memory.

SLASH COMMANDS

  • /alc : Displays commands in chat
  • /alcon : Toggle Auto Cleanup
  • /alcui : Toggle Memory UI visibility
  • /alclock : Lock/Unlock UI dragging
  • /alcreset : Reset UI position
  • /alcbar : Toggle Memory UI Bar
  • /alcgraph/alcgraphlock/alcgraphreset : Graph controls
  • /alclite/alcdiags : Diagnostics toggles
  • /alcfps/alcping/alcframetime/alcgains : Performance tracking
  • /alcsession/alcsessionlock/alcsessionreset : Session UI
  • /alcstatpeak/alcstatavg/alcstatfinal/alcstatclean : Log toggles
  • /alccsa : Toggle Announcements
  • /alclogs (PC Only) : Toggle Chat Logs
  • /alcstats : Toggle Saving Statistics
  • /alcprofile/alcself/alclibs : Profiler toggles & filters
  • /alcstart/alcprostop/alcprolist : Profiler scan controls (60s PC / 30s Console)
  • /alcdelvars : Reset ALL settings to defaults
  • /alcclean : Force manual Lua memory cleanup

TROUBLESHOOTING & SYSTEM LIMITS

Engine Limits & Shared Memory: Because the ESO logic manages memory dynamically in a single global pool, we must rely on smart, threshold-based sweeping rather than passive monitoring.

Warning

Important Note On Memory Usage (PC & Console): Unlike PC, where memory scales dynamically with a ~512 MB "soft limit" for UI lag, consoles have a strict 100 MB hardware memory pool for addons. Reaching the console cap will often cause the game to forcefully reload your UI or result in "Out of Memory" crashes.

Note

Do You Actually Need This (PC & Console)? NO. If your total Lua memory usage consistently stays below 300 MB on PC (with an SSD), or below 70 MB on Console, the native ESO logic is usually efficient enough on its own.

TESTED: I have personally stress tested this addon while having 335+ active addons enabled (some of them are libraries) during Dungeon Trifecta runs on Linux (while on Discord, with multiple browser tabs open) and had zero issues and crashes.


LICENSE & USAGE

Copyright (c) 2021-2026 @APHONlC. All rights reserved.

No Redistribution: Please do not re-upload, mirror, or distribute this script to other platforms (ESOUI, NexusMods, etc.) without my explicit written permission.

No Public Modifications: You may not modify, transform, or build upon this code for the purpose of public release.

Personal Use: You are 100% free to tweak and modify the code for your own private, personal use.

Licensed under the Apache License, Version 2.0.

(For permissions or inquiries, contact @APHONlC on ESOUI or GitHub.)

How to Attribute This Work: If you use, redistribute, or modify this script in your own project, please attribute it:
Project Name: Auto Lua Memory Cleaner
Author: @APHONlC
License: Apache License 2.0

Check out my other addons/projects:

Auto Lua Memory CleanerPermanent MementoTamriel Trade Center, HarvestMap & ESO-Hub Auto-Updater (Linux, macOS, SteamDeck, & Windows)

If this project has been useful to you, consider supporting its development:

Buy Me A Coffee


BUG REPORTS

If you encounter any issues, please submit a report here:
ESOUI Bug Portal | GitHub Issue Tracker

About

A lightweight, event driven Lua memory cleaner for Elder Scrolls Online.

Topics

Resources

License

Apache-2.0, Apache-2.0 licenses found

Licenses found

Apache-2.0
LICENSE
Apache-2.0
LICENSE.md

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors

Languages