Repository navigation
Tests: Free the dummy Node in the BTForEach and BTSetVar tests - #476
Merged
Merged
Conversation
Both test cases memnew a Node and never free it. Every other test in the suite that creates one pairs it with a memdelete; these two are the outliers. doctest re-enters a TEST_CASE body once per leaf SUBCASE, so the cost is one Node per leaf: 4 from BTForEach and 18 from BTSetVar. Godot reports them as "22 ObjectDB instances were leaked at exit", and on a build with use_asan=yes LeakSanitizer fails the run outright: Direct leak of 14400 byte(s) in 18 object(s) test_set_var.h:30 Direct leak of 3200 byte(s) in 4 object(s) test_for_each.h:24 SUMMARY: AddressSanitizer: 17600 byte(s) leaked in 22 allocation(s). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A4XimeYTjpo3crzdyNFrcn
limbonaut
approved these changes
Sep 4, 2026
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.
tests/test_for_each.handtests/test_set_var.heachmemnewaNodeand never free it. Every other test in the suite that creates one pairs it with amemdelete— for exampletest_check_var.h,test_check_trigger.handtest_call_method.h— so these two look like oversights rather than intent.doctest re-enters a
TEST_CASEbody once per leafSUBCASE, so the cost is one leakedNodeper leaf: 4 fromBTForEachand 18 fromBTSetVar.Running the suite in a
tests=yesbuild reports:and on a build with
use_asan=yes, LeakSanitizer fails the run outright:With both
memdeletes added, the full Godot test suite reports 0 leaked instances and the same number of passing cases as before.🤖 Generated with Claude Code