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

silo_f.c: add an interface to free an option set with dbaddcaopt #244

Merged
merged 6 commits into from
Apr 14, 2022

Conversation

cessenat
Copy link
Contributor

Hi @markcmiller86
I'm very pleased to open my first PR for Silo !
I hope I'm on the right branch (I took 'main').

To make it short, when using dbaddcaopt, one gets a memory leak. This PR is to provide a user Fortran function to remove memory before calling dbfreeoptlist

To tell the whole story, I met a puzzling bug using dbaddiopt : I had not realized that the DBoptlist values were pointers only, so when I called dbaddiopt(optid, DBOPT_NMATNOS, n-1), I did not realize that my smart gfortran optimal memory manager compiler decided to reuse the address of (n-1) for another purpose - which was a write(6, FMT='("hello folks")') : so my number of materials changed unexpectedly ! When I grasped what were DBoptlist values I understood there was a memory leak dbaddcaopt.
And that's it !

Maybe both things (the short and the full stories) could be added to documentation, at a later time.

@cessenat
Copy link
Contributor Author

Hello @markcmiller86 , sorry for pinging...

@markcmiller86
Copy link
Member

Yes, for sure. Am making a pass over Silo getting ready for a 4.11.1 release and will get to this and other recently reported issues.

@markcmiller86 markcmiller86 self-requested a review April 14, 2022 07:11
@markcmiller86 markcmiller86 merged commit bbbf77f into LLNL:main Apr 14, 2022
@markcmiller86
Copy link
Member

I need to backport to 4.11RC too

markcmiller86 added a commit that referenced this pull request Apr 14, 2022
silo_f.c: add an interface to free an option set with dbaddcaopt
markcmiller86 added a commit that referenced this pull request Apr 14, 2022
@cessenat cessenat deleted the add_dbfreeoption_fortran_memory branch April 14, 2022 14:31
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.

2 participants