_deref() in a TIE implementation object

_deref() in a TIE implementation object

Post by Hrishikesh Dixi » Wed, 22 Apr 1998 04:00:00

Hi all,

I'm running into some memory corruption problems while using
the TIE approach for implementation, especially with the
deletion of the implementation objects on the server side.

Briefly, here's the situation :

I have an interface 'foo.idl' defined.
I have an implementation object foo_i that implements the
foo interface using the TIE approach. So my implementation
object is independent of the CORBA-generated classes.
I create some foo_i objects on the server, TIE them to
CORBA objects and return them to the client as a part of
a container CORBA object fooContainer (which happens to be
implemented by the BOA method).
The client invokes method op1() on a fooContainer, in response
to which I want retrieve a reference to the foo_i object that
it contains (as a TIE-ed CORBA object), and cache it on the
server. I can obtain the reference through a _deref() on the
TIE-ed object.
The client then invokes a method op2() on fooContainer in
response to which I want to delete the cached foo_i object.
This operation gives me a FUM error (Freeing Unallocated Memory)
in Purify.

Here's the sample code : (I'm using Orbix-2.3MT on Solaris 2.5.1)

                CLIENT                                  SERVER
                ------                                  ------

        fooContainer_ptr fc ;                   fooContainer_ptr fc=
                                                  new fooContainer_i() ; // BOA Impl.
                                                foo_i *f= new foo_i() ;
                                                foo_ptr fp=
                                                  new TIE_foo(foo)(f) ; // TIE Impl.
                                                fc->addFooObject(fp) ;

        <bind to fooContainer> -------------->  <return fc>

        int n ;

        foo_ptr fp=
          fc->getFooObject() ;
        fc->op1(fp, n) ;  ------------------->  fooContainer_i::op1(foo_ptr fp,
                                                                    int n) {
                                                   foo_i *f = (foo_i *) fp->_deref() ;
                                                   foo_cache[n]= (foo_i *) f ;

        fc->op2 (n) ------------------------->  fooContainer_i::op2 (int n) {
                                                   foo_i *f= foo_cache[n] ;
                                                   delete f ; <===== FUM error !!

The server does not crash immediately, but a few iterations of this
and it bails out with a seg-fault.

Anyone run into this before ? The issue is, does a _deref() return me
the same memory that I allocated for the implementation object ? It's
documented that _deref() is not very reliable when it comes to operations
pertaining to destruction, so what I'm doing here is not a good idea
anyway, but I just wanted to know if the behavior of _deref() is
deterministically flawed, or is it just something that "may or may not

Any pointers greatly appreciated.

Thanks !



 Hrishi Dixit                S C H L U M B E R G E R

 281.285.4065    voice       Sugar Land Product Center          
 281.285.4344    fax         110 Schlumberger Drive            


1. ORBIX: Narrowing object references of TIE objects impossible ???


we use ORBIX 2.0.2 and want to narrow the object reference of Account to
a CheckingAccount whereby Account is the base class of Checking Account.

The difference to the example in the programming guide, page 37, is that
we use the TIE approach.

At runtime we get the following error:=20
"10023 -- An invalid parameter was passed
- CORBA::Object::_narrow  (Object*) failed"

Is this a programming error or isn't it possible to use narrowing with
TIE objects???

thanks for any help

Matthias Muellereisert

Account_ptr aPtr =3D new TIE_Account(Account_i) (new Account_i());
CheckingAccount_ptr caPtr;
try {
=09caPtr =3D CheckingAccount::_narrow(aPtr);
=09cerr << &sysEx << endl;

                                                  \\  ^ ^  //=20

Matthias M=FCllereisert           Fachhochschule Karlsruhe
Winterstr. 37                   IIT (Institut fuer Innovation und
76137 Karlsruhe                 Softwarelabor ENTEBA
Germany                        =20
Tel: 049-721/38 61 16           Tel: 049-721/925 23 28

WWW: http://www.FH-Karlsruhe.de/~muma0016

                                                    oooO   (   )=20
                                                    (   )   ) /=20
                                                     \ (   (_/=20

2. Cost of locks on PPro multiprocessors

3. tie implementation question

4. Active Desktop wall paper

5. tie or no_tie: What about tie and no_tie ?

6. Suggest flowchart or flowblock program?

7. Find the implementation Object from ORB object

8. Design question: CORBA Object Implementation and Domain Object Models

9. Separate Factory Object and implementation Object?

10. Object reference to implementation object

11. How to find the implementation object form VisiBroker ORB object

12. Deleting tie object causes core dump