Open n8xm opened 1 week ago
@anigmetov Do you remember why this was done in the first place? I can't imagine a situation where we want to take ownership of the data in the first place.
Either way, the proposed solution sounds good to me.
@mrzv Probably, I added the destructor for a specific setup that we had in our experiments for the paper: in order to avoid IO, the data were read from disk once and then we ran Reeber many times on the same data that were copied into a block, to report average running time of the algorithm. If you don't have any other case where we need to take ownership, getting rid of the destructor altogether may be a better solution.
Currently,
FabBlock
's destructor frees the data that is passed into its constructor asT* data
. This behavior assumes thatFabBlock
owns the data.In order to avoid a double free, there should be a way to support construction of a
FabBlock
from a non-owning pointer. Perhaps a flag could be added to theFabBlock
's constructor in order to indicate that a non-owning pointer is being passed.The above summarizes a discussion I had with @anigmetov after encountering a double free error when using Reeber for in-situ halo finding in the Nyx cosmology code.