Skip to content

prevent memory leak by making sure all memory allocated by `prepare_prelinked_interpretation` is freed once the constructed `PrelinkedInterpretationEnvironment` is not used anymore

Steffen Michels requested to merge memoryLeaks into main

What does this MR do?

This prevents memory leaks by making sure all memory allocated by prepare_prelinked_interpretation is freed once the constructed PrelinkedInterpretationEnvironment is not used anymore. When running unit tests, for each test, a new IWorld is constructed and prepare_prelinked_interpretation is used.

I do the following:

  • After the PrelinkedInterpretationEnvironment is constructed, I free all memory allocated for the program, except the code, directly. As far as I can see, this is safe, but please verify this!
  • I use a finalizer to free the memory for the code, at the point the PrelinkedInterpretationEnvironment is garbage collected.

Changes to public APIs

none

Author's checklist (required)

  • If bugs have been solved, tests have been added (guidelines)
  • A changelog entry has been added (guidelines)
  • Newly added code is documented (guidelines)
  • Newly added code has a style consistent with the rest of the repository
  • Intermediate commits compile (use git rebase -i main if not)

Related issues

Edited by Steffen Michels

Merge request reports