Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible memory leak in constructors #3062

Merged
merged 7 commits into from
Dec 15, 2023

Conversation

njzjz
Copy link
Member

@njzjz njzjz commented Dec 14, 2023

When a constructor throws an exception, it will not call the destructor as the constructor is not finished. The memory leak happens here and is detected by LeakSanitizer (thanks, @Cloudac7, for reminding me to use it). We must catch the exception, delete the memory, and re-throw the exception.

@njzjz njzjz requested a review from wanghan-iapcm December 14, 2023 21:53
@github-actions github-actions bot added the C++ label Dec 14, 2023
Copy link

codecov bot commented Dec 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0547940) 75.73% compared to head (0977564) 75.79%.
Report is 12 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #3062      +/-   ##
==========================================
+ Coverage   75.73%   75.79%   +0.05%     
==========================================
  Files         245      245              
  Lines       24685    24900     +215     
  Branches     1591     1597       +6     
==========================================
+ Hits        18696    18872     +176     
- Misses       5054     5090      +36     
- Partials      935      938       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wanghan-iapcm wanghan-iapcm merged commit e048389 into deepmodeling:devel Dec 15, 2023
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants