Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] RFC: assert() to ensure OBJ_CONSTRUCT'ed objects don't get destroyed
From: Jeff Squyres (jsquyres) (jsquyres_at_[hidden])
Date: 2013-03-08 05:55:30


On Mar 7, 2013, at 7:37 PM, George Bosilca <bosilca_at_[hidden]> wrote:

> An example will be a memory region without a predefined size, that I manipulate as opal_list_item_t. This fragment gets allocated when it's size is know, then gets OBJ_CONSTRUCT'ed and then used. The reference count is playing its role, when nobody is using the object anymore, it will be automatically released. With the change you propose such usage will be prohibited.

Ah, ok -- are you saying to do the following:

myobj = malloc(...);
OBJ_CONSTRUCT(myobj, ...);

?

If so, yes, I agree, #1 would disallow that [valid] use case. And we wouldn't want to disallow that.

But that's ok; #2 is the important one -- #1 just seemed like a good compliment to what was already there that we figured we'd do at the same time. But we didn't know if there were other valid use cases that #1 would violate, which is why we RFC'ed/asked.

> PS: The second patch (ref count == 1 in OBJ_DESTRUCT) is trivial but reasonable.

Yeah -- unfortunately, while the patch to add that assert() is trivial, it's finding lots of ref counting bugs in the MPI layer, so I don't want to commit it yet. :-) I'll come back with more info after I've sorted through them...

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/