[omniORB] To delete or not to delete....

David Riddoch djr@orl.co.uk
Wed, 13 Jan 1999 09:38:18 +0000 (GMT)



As far as I know what you've done is correct. If you look in the stub
code, you should see something like this ...

CORBA::Boolean _sk_server::dispatch(...)
{
  if (strcmp(_0RL_op,"query") =3D=3D 0) {
    ...
    long_seq_var _0RL_result;
    _0RL_result =3D query();
    ...
  }
  ...
}

So the sequence should be deleted by the destructor of long_seq_var.

Let us know if you find a leak in the ORB!

Cheers, David


On 12 Jan 1999 bjornw@fairplay.no wrote:

> Hi omniorbers!
>=20
> Let us say that I have a server that allocates a sequence of elements,
> and that the client deletes it. Is that it? The reason I'm asking is
> because I have a server that grows and grows and grows ...=20
>=20
> Here is some pseudo code that illustrate a typical scenario
>=20
> // idl file
> typedef sequence<long> long_seq;
>=20
> interface server {
>   long_seq query();
> };
>=20
> // server-implementation
> long_seq *
> server::query()
> {
> =09long_seq *ptr =3D new long_seq;
> =09return ptr;
> }
>=20
> // client implementation
> long_seq *ptr =3D server->query();
> delete ptr;
>=20
> bjornw> Sincerely
>=20
> -------------------------------------------------------
> Bj=F8rn Wennberg              email: bjornw@fairplay.no=20
>                                ms: +47 950 82 657
> Senior Programmer           phone: +47 22405538
> FairPlay International AS     fax: +47 22405539
>=20
>=20