Skip to content

Fix some memory issues

Beerwerth, Randolf requested to merge develop-memory into develop

This fixes a memory leak in the multilayer. Furthermore in the unit tests correct release of acquired memory is ensured.

  • The clone created in MultiLayer::addLayerWithTopRoughness is passed by reference into addLayer. There it is cloned again. After returning to MultiLayer::addLayerWithTopRoughness the clone created here is lost in space.
  • The addLayerWithTopRoughness method performs a clone. Hence the behavior of a multilayer is not changed, it is still fully cloned. No manual tests in GUI etc. were performed.
  • The primary reason to cleanly release resources is to enable use of a debugger for memory leak detection on the unit tests (that is how i discovered the MultiLayer leak). If they are not cleaned properly, it is impossible to run the debugger on that to look for such issues. Furthermore, cleanly doing that teaches a user who looks into the examples where she takes over ownership of the ressources and needs to assure deletion afterwards. For me, unit tests are always an important example to learn the intented use of structures and other things. Hence i find it incredibly important that they are used correctly in those tests.
Edited by Beerwerth, Randolf

Merge request reports

Loading