Mem leak fix#60
Open
lygstate wants to merge 2 commits into
Open
Conversation
Null comp after delete so a second close() or finalizer path does not double-free the same BasicComponent. Native - component.hpp: WRAPPED_JS_CLOSE_COMPONENT guards s->comp
1f8ba4a to
1ec181f
Compare
React unmount leaked comp_map entries and JS shells; instanceMap used bracket syntax on a Map. Reconciler now tracks host children, closes children before parents, and calls close() on detach. Reconciler (src/render/react/core/reconciler/index.js) - instanceMap: .set() / .get() / .delete(); detachInstance with _detached guard - _hostChildren tracking; recursive child detach before parent close - removeChild, removeChildFromContainer, detachDeletedInstance call detachInstance - Teardown order owned by JS (children close before parent); comments document contract Native (src/render/native/core/basic/comp.cpp) - removeChild: bookkeeping only (parent_instance); no reparent to window root - destructor: style reset, lv_obj_remove_event_cb, lv_obj_del on close() path
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.
Summary by cubic
Fixes native and React reconciler memory leaks by properly detaching and deleting components. Prevents
comp_mapgrowth, double frees, and orphaned instances; adds leak probes and a CLI test runner with faster builds.Bug Fixes
close()idempotent inWRAPPED_JS_CLOSE_COMPONENT(guards/s->comp, deleteBasicComponent, setnullptr); makeremoveChilda no-op (no reparenting; JS owns teardown); destructor resets styles, removes event callback, deletes LVGL instance if valid, then nulls it.instanceMap.set/get/delete; track host children;detachInstancerecursively closes children before the parent, guards double-detach, unregisters events, clears style, thenclose(); applied inremoveChild,removeChildFromContainer, anddetachDeletedInstance.New Features
RenderUtil.getCompMapSize()andupdateTestTree()inlvgljs-ui.binding-leak,calendar-leak) and parallelesbuildfor faster test builds.Written for commit f14e6e2. Summary will update on new commits.
Closes: #19