diff --git a/CHANGELOG.md b/CHANGELOG.md index 025bd47..deed42b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this OctoWoW edition of Gentle GC. Versions follow `GentleGC.toc`. Dates are the commit dates (UTC). +## 2.8.2 - 2026-11-02 + +### Fixed +- The weirdperformance cycle counter in `/ggc` also counted heap drops of a few KB + (40 "cycles" freeing 1.3 MB in all). Drops under 64 KB are no longer counted or + printed; they are still not blamed on an unknown addon. + ## 2.8.1 - 2026-11-02 ### Fixed diff --git a/GentleGC.lua b/GentleGC.lua index 6e47408..5afbead 100644 --- a/GentleGC.lua +++ b/GentleGC.lua @@ -350,9 +350,12 @@ local function Sync() -- someone called collectgarbage; we can't tell, and it isn't a cached call. minor = true liveKB = used - wpStat.minor = wpStat.minor + 1 - wpStat.minorKB = wpStat.minorKB + (lastUsed - used) - if DebugLevel() >= 2 then + -- drops under 64 KB are noise (a few strings dying); don't count or print them + if lastUsed - used >= 64 then + wpStat.minor = wpStat.minor + 1 + wpStat.minorKB = wpStat.minorKB + (lastUsed - used) + end + if lastUsed - used >= 64 and DebugLevel() >= 2 then Msg(format("weirdperformance cycle: freed %.1fmb (heap %.1f -> %.1fmb, threshold %.1f -> %.1fmb)", MB(lastUsed - used), MB(lastUsed), MB(used), MB(oldThreshold), MB(threshold))) end diff --git a/GentleGC.toc b/GentleGC.toc index d8d12ce..37cc64e 100644 --- a/GentleGC.toc +++ b/GentleGC.toc @@ -2,7 +2,7 @@ ## Title: Gentle GC ## Notes: Schedules Lua garbage collection for moments you won't notice ## Author: Weird Vibes (MarcelineVQ); forks by TheRealFayz, jrc13245 -## Version: 2.8.1 +## Version: 2.8.2 ## SavedVariables: GentleGCDB GentleGC.lua diff --git a/README.md b/README.md index 549994b..b76df89 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![ClassicAPI](https://img.shields.io/badge/ClassicAPI-Optional-yellow.svg)](https://github.com/brues-code/ClassicAPI) [![weirdperformance](https://img.shields.io/badge/weirdperformance-Optional-yellow.svg)](https://codeberg.org/MarcelineVQ/WeirdUtils) -Gentle Garbage Collection, unified edition (v2.8.1), maintained for OctoWoW. +Gentle Garbage Collection, unified edition (v2.8.2), maintained for OctoWoW. For WoW 1.18.1 clients (Lua 5.0). diff --git a/tests/test_wp_minor.lua b/tests/test_wp_minor.lua index 0f16374..359767b 100644 --- a/tests/test_wp_minor.lua +++ b/tests/test_wp_minor.lua @@ -105,4 +105,17 @@ check("with heap and threshold numbers", string.find(lastMatch("collection by un cmd("status") check("listed under other addons", has("by other addons: 1")) +print("3. a drop of a few KB is not counted") +roomy() +seconds(2) +clear() +GARB = {} +for i = 1, 300 do GARB[i] = { i } end +seconds(1) +GARB = nil +origCG(); origCG(math.floor(gcinfo() * 1.25)) +seconds(2) +check("tiny drop not printed as a cycle", not has("weirdperformance cycle: freed")) +check("tiny drop not an unknown addon", not has("collection by unknown addon")) + print(FAILED and "SOME TESTS FAILED" or "ALL TESTS PASSED")