WoW GarbageProtector addon Shadowlands/Burning Crusade Classic 2021
logo
wow addon GarbageProtector

GarbageProtector

Game Version: 2.5.1
Total Downloads: 6,297
Updated: Jul 4, 2021
Created: Sep 9, 2016
download GarbageProtectorDownload Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
2021-07-04-release-bcc release 4.99 KB Jul 4, 2021 2.5.1 0 download GarbageProtector 2021-07-04-release-bcc releaseDownload
2021-07-04-release-classic release 4.99 KB Jul 4, 2021 1.13.7 0 download GarbageProtector 2021-07-04-release-classic releaseDownload
2021-07-04-release release 4.99 KB Jul 4, 2021 9.1.0 0 download GarbageProtector 2021-07-04-release releaseDownload
2018-08-13-release release 3.83 KB Aug 13, 2018 8.0.1 1,486 download GarbageProtector 2018-08-13-release releaseDownload
2018-08-01-release release 3.72 KB Aug 1, 2018 8.0.1 549 download GarbageProtector 2018-08-01-release releaseDownload
2017-09-03-release release 3.72 KB Sep 4, 2017 7.3.0 1,150 download GarbageProtector 2017-09-03-release releaseDownload
2017-07-22-release release 3.73 KB Jul 22, 2017 7.2.5 607 download GarbageProtector 2017-07-22-release releaseDownload
2016-10-27-release release 3.83 KB Oct 27, 2016 7.1.0 1,227 download GarbageProtector 2016-10-27-release releaseDownload
2016-09-15-release-3 release 3.84 KB Sep 15, 2016 7.0.3 704 download GarbageProtector 2016-09-15-release-3 releaseDownload
2016-09-15-release-2 release 3.82 KB Sep 15, 2016 7.0.3 108 download GarbageProtector 2016-09-15-release-2 releaseDownload
2016-09-15-release release 3.88 KB Sep 15, 2016 7.0.3 160 download GarbageProtector 2016-09-15-release releaseDownload
2016-09-09-release release 1.50 KB Sep 9, 2016 7.0.3 306 download GarbageProtector 2016-09-09-release releaseDownload

Description

Share this:

Some WoW addons call the lua collectgarbage function irresponsibly, causing all execution to halt until it is finished. This can take more than half a second, which freezes the game in an annoying manner. Most addons don’t need to make such calls, but some do anyway, causing these lockups.

Instead of maintaining the removal of collectgarbage calls in all the addons I use, I decided to write this tiny addon which intercepts these irresponsible collectgarbage calls to prevent these chunky lockups and freezes. Now my game feels smoother when performing various actions which previously caused stutters from collectgarbage.

I’ve also added a hook for UpdateAddOnMemoryUsage, a CPU-intensive function which I found several addons were calling when they weren’t even profiling for any reason. With this addition, I figured some people may want the option to disable this hook so they can do memory profiling with GarbageProtector on, so I made CLI and GUI options menus. Plus, if you’re an addon author, you can run ToggleGarbageProtector, ToggleHandlecollectgarbage, or ToggleHandleUpdateAddOnMemoryUsage directly to disable the interference of either of GarbageProtector’s hooks.

The addon’s folder name has 3 “!”s at the beginning to cause it to be loaded first, before any addons that would slow loading screens with collectgarbage calls. There is another addon with 2 “!”s that I wanted GarbageProtector to load before, so that’s why 3 instead of 2 or 1.

Warning: Due to the nature of the 2 hooks GarbageProtector implements, unless the hooks are toggled off (from either the GarbageProtector options menu, the command line interface, or the Lua setter functions), it will prevent:

  • full manual garbage collection cycles (function named “collectgarbage”; does not prevent the regular rate of Lua’s garbage collector)
  • updating the current count of addon memory usage (function named “UpdateAddOnMemoryUsage”; makes profiling addons show 0 or their most recently-queried value)

For example, ElvUI has a feature to run a garbage collection manually by clicking somewhere. This is prevented by GarbageProtector because it is an irresponsible use of collectgarbage which locks up your game (which if run automatically like some addons do, is not nice to the user). However, if you really want to run it, you can toggle GarbageProtector’s option with “/gp collectgarbage” or from the GUI options menu. That’s why I added options in the first place: so you can choose what you want to do.

Comments

Add a comment