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

ARKODE Stepper SetDefaults memory leak fix #560

Merged
merged 16 commits into from
Sep 11, 2024
Merged

Conversation

drreynolds
Copy link
Collaborator

Updated stepper SetDefaults routines to deallocate pre-existing structures before nullifying, and moved initial creation of the SUNAdaptController into stepper SetDefaults routines instead of arkCreate. This allows non-adaptive steppers to leave the SUNAdaptController object unallocated.

…tures before nullifying, and moved initial creation of the SUNAdaptController into stepper SetDefaults routines instead of arkCreate
doc/shared/RecentChanges.rst Outdated Show resolved Hide resolved
src/arkode/arkode_arkstep_io.c Outdated Show resolved Hide resolved
src/arkode/arkode_erkstep_io.c Show resolved Hide resolved
@drreynolds drreynolds mentioned this pull request Sep 10, 2024
@balos1 balos1 added this to the SUNDIALS Next milestone Sep 10, 2024
src/arkode/arkode.c Show resolved Hide resolved
src/arkode/arkode_arkstep_io.c Show resolved Hide resolved
src/arkode/arkode_arkstep_io.c Show resolved Hide resolved
src/arkode/arkode_arkstep_io.c Show resolved Hide resolved
Copy link
Member

@gardner48 gardner48 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the minor suggestion to remove an erroneous new line, do arkPrintAdaptMem and arkAdapt also need checks for a NULL controller?

src/arkode/arkode_io.c Outdated Show resolved Hide resolved
@drreynolds
Copy link
Collaborator Author

Other than the minor suggestion to remove an erroneous new line, do arkPrintAdaptMem and arkAdapt also need checks for a NULL controller?

The NULL check was indeed necessary in arkPrintAdaptMem. I added it to arkAdapt as well just in case, but since any non-adaptive stepper (who leaves a NULL-valued SUNAdaptController) must also set ark_mem->fixedstep to SUNTRUE, that check should be redundant.

@gardner48 gardner48 merged commit 8d3eff4 into develop Sep 11, 2024
24 of 25 checks passed
@gardner48 gardner48 deleted the bugfix/setdefaults branch September 11, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] ARKodeSetDefaults Memory Leaks and Inconsistencies
4 participants