On Mar 7, 2013, at 7:37 PM, George Bosilca <bosi...@icl.utk.edu> 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
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/


Reply via email to