Skip to content

Conversation

@fredroy
Copy link
Contributor

@fredroy fredroy commented Jan 27, 2026

Related (and fix) : #5890

Description:
Searching for memory leaks, I detected big ones coming from TetrahedronFEMForcefield.
In particular the colorMap, which was supposed to be deleted in the destructor.
I noticed that the destructor was not called and then... asked Claude which found that slaves was keeping a reference to their owner, and so the reference counter of the Sptr was not at the end of the program (so not the dtor was not called).

Easy solution is to unlink the slaves during the cleanup phase (what is done in this PR)
Only problem is if a component is overriding this function and not calling super::cleanup() 💀
(template method design blabla for BaseObject blabla 🫠)

[with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@fredroy fredroy added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request labels Jan 27, 2026
@hugtalbot hugtalbot added the topic for next dev-meeting PR to be discussed in sofa-dev meeting label Jan 27, 2026
@fredroy
Copy link
Contributor Author

fredroy commented Jan 27, 2026

[ci-build][with-all-tests]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request topic for next dev-meeting PR to be discussed in sofa-dev meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants