coin-or / ADOL-C

A Package for Automatic Differentiation of Algorithms Written in C/C++
Other
146 stars 31 forks source link

Fix memory leak in `zos_pl_forward` and add deallocation of tape signature to `freeTapeResources` #84

Closed AdrianSchmidt1 closed 1 week ago

AdrianSchmidt1 commented 1 week ago

This PR includes two changes:

  1. It removes a redundant double *signature in the function zos_pl_forward in uni5_for.c which caused problems due to allocation but missing deallocation of memory.
  2. It adds freeing of the tape signature in the function freeTapeResources in taping.c which has previously been missing. This caused memory leaks when reusing tape IDs even when using the function removeTape before creating the new tape.

At a future point it would be very useful to add a note to the README.md which points out that the function removeTape must be called before rewriting a tape reusing a tape ID in one execution. This workaround will prevent the aforementioned memory leak until ADOL-C adds the feature to automatically remove the tape before retaping in case the tape ID is reused. (Lot's of 'tape' in one sentence, hope it's clear what I mean)

CLAassistant commented 1 week ago

CLA assistant check
All committers have signed the CLA.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 65.95%. Comparing base (fbd8948) to head (6c58e40). Report is 8 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #84 +/- ## ========================================== + Coverage 65.64% 65.95% +0.31% ========================================== Files 50 51 +1 Lines 26438 26473 +35 Branches 1841 1843 +2 ========================================== + Hits 17355 17461 +106 + Misses 9083 9012 -71 ``` | [Flag](https://app.codecov.io/gh/coin-or/ADOL-C/pull/84/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=coin-or) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/coin-or/ADOL-C/pull/84/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=coin-or) | `65.95% <100.00%> (+0.31%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=coin-or#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features: