gc: per-frame memory-pressure detection + heap pinning + with_await fix#195
Merged
Conversation
Detection mode (imgui_boost_runtime), ported from strudel_player's heap-delta tracking: - imgui_debug_memory(enabled) / imgui_reset_memory_baseline() / imgui_memory_report(): baseline + running max + a periodic per-frame log of heap / string-heap usage, gated behind a flag (one bool test per frame when off). - sample_memory() runs once per frame from begin_frame (the universal per-frame reset); teardown summary in harness_shutdown (+ a WARNING if heap/str grew past 64kb since baseline). - imgui_memory_debug live-command (visual_aids) so the recorder / MCP can toggle it remotely. with_await: add the await modifiers onto the result object in place via the new json update() helper, instead of copying every field into a fresh table and orphaning the original wrapper each call. options persistent_heap on imgui_boost_runtime + imgui_harness (collectable heap so per-frame JsonValue churn is reclaimed by delete + GC; runtime options unify program-wide). Depends on the json delete_json/update/json_null_sentinel helpers (daslang PR). Verified on a live buttons.das run: with imgui_memory_debug on, the steady heap held flat at ~0x21kb across 5500+ frames including snapshot dispatches (the formerly-leaking path); full integration suite shows no regression. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The GC-pressure detection work added imgui_debug_memory / imgui_reset_memory_baseline / imgui_memory_report (imgui_boost_runtime) and the imgui_memory_debug live command (imgui_visual_aids). Add a "Memory debugging" group_by_regex for each module so they are categorized instead of tripping the Uncategorized doc gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in tool to see per-frame GC pressure in imgui apps, pins the collectable heap, and fixes one per-command leak. Pairs with the daslang json PR (GaijinEntertainment/daScript#3034), which does the heavy lifting (frees dispatched snapshot trees,
?[]sentinel) —with_awaithere uses the newupdate()from that PR, so merge #3034 first.Detection mode (
imgui_boost_runtime)Ported from
strudel_player's heap-delta tracking:imgui_debug_memory(enabled)/imgui_reset_memory_baseline()/imgui_memory_report()— baseline + running max + a periodic per-frame line of heap / string-heap usage, gated behind a flag. Off by default — one bool test per frame when off.sample_memory()runs once per frame frombegin_frame()(the universal per-frame reset); a teardown summary fires fromharness_shutdown(), with a WARNING if heap or string-heap grew past 64 kb since baseline.imgui_memory_debuglive-command (inimgui_visual_aids, the debug-toggle home) so the recorder / MCP can flip it remotely.with_awaitleak fixRewritten to add the await modifiers onto the result object in place via the new
update(), instead of copying every field into a fresh table and returning that — which orphaned the originalJV(payload)wrapper on every await-wrapped command.Heap pinning
options persistent_heaponimgui_boost_runtime+imgui_harness(collectable heap so per-frame JsonValue churn is reclaimed bydelete+ GC; runtime options unify program-wide).Verification
buttons.dasrun withimgui_memory_debugon: the steady heap held flat at ~0x21 kb across 5500+ frames, including the heavyimgui_snapshotdispatches at frames 2779/4856 —maxbriefly ticked to 0x26 kb on a snapshot then the steady heap returned, i.e. the ~40-widget tree is built and freed (the formerly-leaking path).🤖 Generated with Claude Code