Skip to content

fixed a memory leak when reading the JSON #83

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

Merged

Conversation

jacobwilliams
Copy link
Contributor

Fixes #82

@milancurcic
Copy link
Member

Thanks!

And just so I'm sure I understand: The reason we don't need to destroy other json_value pointers, in this case, is because they are all pointing to child nodes of model_config_json, so by destroying it, we free the whole structure including the child nodes, yes?

@milancurcic milancurcic merged commit 0cbf797 into modern-fortran:main Jun 10, 2022
@jacobwilliams jacobwilliams deleted the 82-memory-leak-hotfix branch June 10, 2022 18:41
@jacobwilliams
Copy link
Contributor Author

Yep, that is correct. The destroy call deallocates the entire tree structure.

The other variables are pointers to the existing structure. When you destroy the structure they are now dangling pointers, but since they are just local variables it doesn't matter.

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.

Memory leak in get_keras_h5_layers
2 participants