Skip to content

Fix training offloading memory leaks#682

Open
myungjoo wants to merge 4 commits intomainfrom
cursor/memory-leak-search-5f1f
Open

Fix training offloading memory leaks#682
myungjoo wants to merge 4 commits intomainfrom
cursor/memory-leak-search-5f1f

Conversation

@myungjoo
Copy link
Member

@myungjoo myungjoo commented Mar 17, 2026

Summary

  • free leaked pipeline string in _training_offloading_services_request() cleanup path
  • clear previously stored strings before overwriting in _ml_service_training_offloading_process_received_data()
  • join and reset existing received_thread before creating a new one in _training_offloading_check_received_data()
  • clear old receiver_pipe before replacing it in _ml_service_training_offloading_prepare_receiver()
  • add explicit libxml-2.0 dependency when enable-tizen-feature-check is enabled
  • add pkgconfig(libxml-2.0) and libxml2 BuildRequires for Tizen feature-check builds
  • add -Wl,-rpath-link,<libxml2 libdir> propagation via nns_capi_common_dep to resolve transitive xml2 dependencies (hal-api-common / pkgmgr-info) during unit-test linking

Notes

  • Changes are limited to project code/build scripts only; no fixes were attempted in external libraries (e.g. gstreamer, glibc).
  • Each memory-leak fix remains as a separate commit.

Validation

  • Verified clean working tree and successful push to cursor/memory-leak-search-5f1f.
  • Build fix is scoped to Tizen feature-check link path and transitive dependency resolution.
Open in Web Open in Cursor 

cursoragent and others added 4 commits March 17, 2026 05:31
Bug: _training_offloading_services_request() allocated 'pipeline' for deferred send but did not free it in the common cleanup path. Repeated requests leaked heap memory.

Fix: free pipeline together with other temporary buffers in the error/done cleanup section.
Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Bug: _ml_service_training_offloading_process_received_data() overwrote receiver_pipe_json_str and trained_model_path without releasing previous allocations when multiple messages arrived.

Fix: call g_clear_pointer() before assigning new duplicated/built strings.
Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Bug: _training_offloading_check_received_data() could overwrite received_thread with a new thread handle without joining the previous one, leaking thread resources across repeated start/check cycles.

Fix: join and nullify an existing thread handle before creating a new watcher thread.
Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Bug: _ml_service_training_offloading_prepare_receiver() reassigned receiver_pipe with g_strdup() on each prepare call without freeing the previous string.

Fix: clear receiver_pipe before storing the new pipeline description.
Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: MyungJoo Ham <myungjoo.ham@samsung.com>
@cursor cursor bot force-pushed the cursor/memory-leak-search-5f1f branch from a1eccfa to 3059174 Compare March 17, 2026 05:32
@cursor cursor bot changed the title Fix multiple training offloading memory leaks Fix training offloading memory leaks and Tizen link dependency Mar 17, 2026
@cursor cursor bot force-pushed the cursor/memory-leak-search-5f1f branch from 5fa7d4a to 3059174 Compare March 18, 2026 06:07
@myungjoo myungjoo changed the title Fix training offloading memory leaks and Tizen link dependency Fix training offloading memory leaks Mar 18, 2026
@myungjoo myungjoo marked this pull request as ready for review March 18, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants