Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GD-598: Fixing memory leaks on test execution (#599)
# Why Running tests via CMD line shows a lot of memory leaks at program exit. # What - fixed releasing of all singletons - `func_assert` has problems with lambdas when using inside `timer.timeout.connect`, converted lambda into function - Handling of stored asserts in the thread context results in inconsistency during cleanup - fixed cleanup on `GdUnitCommandHandlerTest` ## Finally, I have reduced most of the memory leaks nodes, but there are still `GDScriptFunctionState` orphaned nodes that I can't solve because these are handled internally by Godot see [74449](godotengine/godot#74449) ``` Statistics: | 947 tests cases | 0 error | 0 failed | 1 flaky | 13 skipped | 0 orphans | Executed test suites: (100/104), 4 skipped Executed test cases: (934/947), 13 skipped Total time: 3min 0s 409ms Open Report at: file:///home/runner/work/gdUnit4/gdUnit4/reports/report_1/index.html Exit code: 0 ---------------------------------------------------------------- Cleanup singletons ["GdUnitThreadManager", "GdUnitDefaultValueDecoders", "GdUnitCommandHandler"] Unregister singleton 'GdUnitThreadManager' Free singleton instance 'GdUnitThreadManager:<Object#507678557642>' Successfully freed 'GdUnitThreadManager' Unregister singleton 'GdUnitDefaultValueDecoders' Free singleton instance 'GdUnitDefaultValueDecoders:<Object#509540832395>' Successfully freed 'GdUnitDefaultValueDecoders' Unregister singleton 'GdUnitCommandHandler' Free singleton instance 'GdUnitCommandHandler:<Object#3858659025580>' Successfully freed 'GdUnitCommandHandler' ---------------------------------------------------------------- Finallize .. done Finallize .. -Orphan nodes report----------------------- Finallize .. done XR: Clearing primary interface XR: Removed interface "Native mobile" XR: Removed interface "OpenXR" WARNING: ObjectDB instances leaked at exit (run with --verbose for details). at: cleanup (core/object/object.cpp:2327) Leaked instance: GDScriptFunctionState:9223373291404658414 Leaked instance: GDScriptFunctionState:92233732947[6010](https://github.com/MikeSchulze/gdUnit4/actions/runs/11956449331/job/33331231410?pr=599#step:4:6018)1646 Leaked instance: GDScriptFunctionState:9223373292545509197 Leaked instance: GDScriptFunctionState:9223373291673093970 Leaked instance: GDScriptFunctionState:9223373293719914330 Leaked instance: GDScriptFunctionState:9223373292881053539 Leaked instance: GDScriptFunctionState:9223373296521709422 Leaked instance: GDScriptFunctionState:9223378085393468557 Leaked instance: GDScriptFunctionState:9223382060754801221 Leaked instance: GDScriptFunctionState:9223373293753472331 Leaked instance: GDScriptFunctionState:9223377142497156399 Leaked instance: GDScriptFunctionState:9223378085359924447 Leaked instance: GDScriptFunctionState:9223382060788375283 Hint: Leaked instances typically happen when nodes are removed from the scene tree (with `remove_child()`) but not freed (with `free()` or `queue_free()`). Orphan StringName: test_case1 (static: 0, total: 1) Orphan StringName: _validate_callback (static: 0, total: 1) Orphan StringName: await_millis (static: 0, total: 5) Orphan StringName: test_timeout_single_yield_wait (static: 0, total: 1) Orphan StringName: test_timeout_2s (static: 0, total: 1) Orphan StringName: _execute (static: 0, total: 1) Orphan StringName: test_timeout_4s (static: 0, total: 1) Orphan StringName: timeout (static: 2, total: 8) Orphan StringName: cb_is_equal (static: 0, total: 2) Orphan StringName: test_timeout_long_running_test_abort (static: 0, total: 1) Orphan StringName: test_timeout_and_assert_fails (static: 0, total: 1) StringName: 11 unclaimed string names at exit. Run tests ends with 0 ```
- Loading branch information