Indeed, if the constructor is called then the destructor should be as
well. Adding the destructor call might be a good idea, despite the
fact that it delays everything till the end of the execution. The
benefits during the execution is minimal, it only keeps valgrind happy
at the end.
Btw, can we merge the two free lists? They looks pretty similar
(except the mpool stuff).
On Tue, May 13, 2014 at 5:01 PM, Nathan Hjelm <hjelmn_at_[hidden]> wrote:
> While tracking down memory leaks in components I ran into an interesting
> issue. osc/rdma uses an opal_free_list_t (not an ompi_free_list_t) for
> buffer fragments. The fragment class allocates a buffer as part in the
> constructor and frees the buffer in the destructor. The problem is that
> the item constructor is called but the destructor is never called.
> I looked into the issue and I see what is happening. When growing the free
> list we call the constructor for each item we allocate (see
> opal_free_list.c:113) but the free list destructor does not invoke the
> destructor. This is different from ompi_free_list_t which does invoke
> the destructor on each constructed item.
> The question is. Is this difference intentional? It seems a little odd
> that the free list does not call the item destructor given that it
> calls the constructor. If this is intentional is there a reason for this
> behavior? If not I plan on "fixing" the opal_free_list_t destructor to
> call the item destructor.
> devel mailing list
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
> Link to this post: http://www.open-mpi.org/community/lists/devel/2014/05/14785.php