#1718 VirtualRefinement leaks memory

Metadata

Property Value
Reported by Carsten Gräser (graeser@math.fu-berlin.de)
Reported at Sep 24, 2015 10:30
Type Bug Report
Version Git (pre3.0)
Operating System Unspecified / All
Last edited by Carsten Gräser (graeser@math.fu-berlin.de)
Last edited at Sep 24, 2015 10:32

Description

VirtualRefinementImp::instance() allocates a new VirtualRefinementImp object and returns a reference and not pointer.

Since a user will not call "delete &refinement;" in general this produces a memory leak, which can, e.g., be observed in the SubsamplingVTKWriter. To fix this issue the factory method should either return a pointer, or (better) a shared_ptr, or (even better) a unique_ptr.