ENH: improved handling of regIOobject deletion (#1276)
-
remove registration and ownership before deleting a regIOobject from within objectRegistry to avoid possible recursion.
-
regIOobject destructor now removes any registered object from registry regardless if ownedByRegistry or not. It also removes always removes the ownership flag to avoid possible recursion.
-
the regIOobject::checkOut() now unconditionally clears file watches. These will only be there if the object is registered (a no-op for an unregistered object), but this additional safety is needed to manage case where the registration has been modified elsewhere (eg, by the objectRegistry).
Merge request reports
Activity
Take a look and see if it makes sense to you. Ran with valgrind --leak-check=full with buoyantSimpleFoam (circuit cooling), pimpleFoam (mixerVessel) and simpleFoam (bump2D) as quick tests.
Seems to look a fair bit better.
Edited by Mark OLESENDiscussed with @andy - will add additional comments and catch the direct deletion path
assigned to @andy
valgrind --leak-check=full buoyantSimpleFoam
==6567== HEAP SUMMARY: ==6567== in use at exit: 32 bytes in 1 blocks ==6567== total heap usage: 77,259 allocs, 77,258 frees, 24,582,355 bytes allocated ==6567== ==6567== LEAK SUMMARY: ==6567== definitely lost: 0 bytes in 0 blocks ==6567== indirectly lost: 0 bytes in 0 blocks ==6567== possibly lost: 0 bytes in 0 blocks ==6567== still reachable: 32 bytes in 1 blocks ==6567== suppressed: 0 bytes in 0 blocks ==6567== Reachable blocks (those to which a pointer was found) are not shown. ==6567== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==6567== ==6567== For counts of detected and suppressed errors, rerun with: -v ==6567== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)