Discussion:
[omniORB] How to get _refCount() on object reference?
Tuyen Chau
2006-10-12 23:45:14 UTC
Permalink
Is there an easy way to get _refCount() on an object reference?

From looking into the source code, I think what I could do is to
override _NP_incrRefCount() and _NP_decrRefCount() in my proxy class and
keep a local reference count on my own. Is that the only way to get
this information, or is there an easier way?

Thanks,
Tuyen
Duncan Grisby
2006-10-23 21:18:11 UTC
Permalink
Post by Tuyen Chau
Is there an easy way to get _refCount() on an object reference?
You can't. What are you trying to achieve by accessing the reference
count? Most things you could attempt to do would be subverted by race
conditions where the reference count changes after you access it.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Tuyen Chau
2006-10-23 21:36:04 UTC
Permalink
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20061023/b35100ef/attachment.htm
Duncan Grisby
2006-11-02 17:06:02 UTC
Permalink
Thanks Duncan We need to use _refCount() for debugging purposes
only. We have a complex client that routinely obtains hundreds of
proxy objects through a fairly involved IDL then release them when they
are done. These objects can have member variables (in their proxy
class) that reference each other due to their hierarchical
relationship. We have a debugging mechanism in place to track the
reference count on objects (used with Orbix) to ensure that the objects
are properly released, and hence, the need to use an equivalent of
_refCount() in OmniOrb.
If it's just for debugging, then the simple thing is to make the
pd_refCount member public, or make yourself a friend of the omniObjRef
class. I don't want to add an accessor function for the reference count,
because that would encourage people to try to use it for other purposes
than just debugging.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Loading...