[omniORB] Need help for memory access violation for unbounde dsequence

sanjaymu@mastek.com sanjaymu@mastek.com
Wed, 28 Feb 2001 15:17:03 +0530


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C0A16B.677446A0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,

I am able to resolve the problem of sever by putting
CORBA::String_var::string_dup() instead of CORBA::string_dup(). But I am
still getting error in client program. My client program is very simple,
which is like this
=09
	TestSequence_var object =3D TestSequence::_narrow(tmp_ref);
	        if(object =3D=3D TestSequence::_nil()){
            	    cout << "Failed to get object" <<endl;
	                return 1;
	       }
  =20
	cout << "Calling TestSequence::ReturnAdds" <<endl;
        	AddList_var add;

        	add =3D object->ReturnAdds();

        	cout << "Result :=3D "
            	     << add[0].name << " "
	                 << add[1].name << " "
            	     << add[2].name << " "
	                 <<endl;

But when this AddList_var releases its memory it crip.=20

After doing some debugging of both server and client I have got to know that
I am getting error in the deallocation of string data type. (AddList is
unbounded sequence of struct Address, which contains one member *name* of
string data type). It seems to be that there is problem in "void
_CORBA_String_member::operator <<=3D (NetBufferedStream& s)" method. (This
method is called by client stub code)
	void _CORBA_String_member::operator <<=3D (NetBufferedStream& s)
	{
		  if( _ptr && _ptr !=3D omni::empty_string )
omni::freeString(_ptr);
		  _ptr =3D 0;

		  CORBA::ULong len;

		//****************************************************
		//****here it takes number of character to allocate********/
		//****************************************************
		  len <<=3D s;
		  if( !len && omniORB::traceLevel > 1 )
_CORBA_null_string_ptr(1);

		  CORBA::ULong nbytes =3D len ? len : 1;
		//****************************************************
		//****but here it actaully allocates len -1
characters********/
		//****************************************************
		  char* p =3D omni::allocString(nbytes - 1);
		  if( !p )  OMNIORB_THROW(NO_MEMORY,0,
CORBA::COMPLETED_MAYBE);

		  if( len ) {
			    try {
			      s.get_char_array((CORBA::Char*)p, len);
			      if( p[len - 1] !=3D '\0' )
			        OMNIORB_THROW(MARSHAL,0,
CORBA::COMPLETED_MAYBE);
			    }
			    catch(...) {
			      omni::freeString(p);
			      throw;
			    }
		  }
		  else  *p =3D '\0';
		  _ptr =3D p;
	}

So if my string is of 4 characters then *len* would be 5, but actual
allocation would be of 4 chars, which actually has to be "4+1".=20

Well this is my investigation.......may be I could be wrong. If any body has
clew please let me know.

Thanks for every body for there help.

Regards,

Sanjay Murudkar



-----Original Message-----
From: Rajshekhar Kishtaiah Chintapalli
[mailto:rajshekhar.chintapalli@wipro.com]
Sent: Wednesday, February 28, 2001 10:43 AM
To: sanjaymu@mastek.com
Cc: omniorb-list@uk.research.att.com
Subject: Re: [omniORB] Need help for memory access violation for
unboundedsequence


Hi Sanjay,

Just check if you are compling using Single threaded libraries . Make it
Multithreaded threaded libraries instead under  the C./C++ tab , option
code generation  in the project settings under using run time libraries.

Your problem most likely is because of that.

Cheers
Raj

sanjaymu@mastek.com wrote:

>  Hi,("I think you should duplicate the object before returning it") I
> am returning unbounded sequence and not CORBA object. Hence the data
> has to be returned as by value. Interestingly, I am able receive
> expected data in my client program but after that sever crashes while
> releasing memory. Also on client side when the received data gets
> released it also result in memory access violation.Regards,
>
> Sanjay Murudkar
> Ext. 1493
>
>      -----Original Message-----
>      From: Andreas Eglseer - Entwicklung
>      [mailto:andreas.eglseer@lisec.com]
>      Sent: Tuesday, February 27, 2001 8:12 PM
>      To: sanjaymu@mastek.com
>      Subject: AW: [omniORB] Need help for memory access violation
>      for unbounded sequence
>
>      HiI think you should duplicate the object before returning
>      it, because the memory gets automatically freed, when the
>      function ends.Cheers,Andreas
>
>           -----Urspr=FCngliche Nachricht-----
>           Von: owner-omniorb-list@uk.research.att.com
>           [mailto:owner-omniorb-list@uk.research.att.com]Im
>           Auftrag von sanjaymu@mastek.com
>           Gesendet am: Dienstag, 27. Februar 2001 15:18
>           An: omniorb-list@uk.research.att.com
>           Betreff: [omniORB] Need help for memory access
>           violation for unbounded sequenceHi,I have written
>           simple program based on sequence<>. My sample
>           CORBA component has onem ethod ReturnAdds() which
>           returns a AddList object which is actually an
>           unbounded sequence of Address struct. My IDL
>           definition is as follows:
>
>                struct Address
>                {
>                 string name;
>                }; typedef sequence<Address>
>                AddList; interface TestSequence
>                {
>                 AddList ReturnAdds();
>                };
>
>           My implementation of ReturnAdds is as follows:
>
>                AddList* TestSequence_i::ReturnAdds()
>                {
>                         cout <<
>                "TestSequenceImpl::ReturnAdds():
>                called." << endl;
>                        AddList* _result;
>                       _result =3D new AddList(3); //
>                allocate memory
>                        _result->length(3);
>
>                     int i =3D 0;
>                     (*_result)[i++].name =3D
>                CORBA::string_dup("Sanjay");
>                     (*_result)[i++].name =3D
>                CORBA::string_dup("Shankar");
>                     (*_result)[i++].name =3D
>                CORBA::string_dup("Murudkar");
>                cout << "TestSequenceImpl::ReturnAdds():
>                returning..." << endl;
>                    return _result;
>                }
>
>           Well I go through my implemented method but the
>           server stub code of the ReturnAdds() method gives
>           me memory access violation. I feel that the code
>           which I have written is right one as it worksp
>           roperly on Orbix2000 1.1.
>           BTW I am using VC++ 6.0 Windows 2000 with VS SP3.
>           Can anybody help me in finding out what problem I
>           am getting.
>           Regards,
>
>           Sanjay Murudkar
>           Ext. 1493


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that =
of Mastek Limited, unless specifically indicated to that effect. Mastek Lim=
ited does not accept any responsibility or liability for it.

This e-mail and attachments (if any) transmitted with it are confidential a=
nd/or privileged and solely for the use of the intended person or entity to=
 which it is addressed.

Any review, re-transmission, dissemination or other use of or taking of any=
 action in reliance upon this information by persons or entities other than=
 the intended recipient is prohibited.

This e-mail and its attachments have been scanned for the presence of compu=
ter viruses. It is the responsibility of the recipient to run the virus che=
ck on e-mails and attachments before opening them.

If you have received this e-mail in error, kindly delete this e-mail from a=
ll computers and please contact the sender on +91-22-829 0635.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

------_=_NextPart_001_01C0A16B.677446A0
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3DISO-8859-=
1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 5.5.2652.35">
<TITLE>RE: [omniORB] Need help for memory access violation for  unboundedse=
quence</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Hi,</FONT>
</P>

<P><FONT SIZE=3D2>I am able to resolve the problem of sever by putting CORB=
A::String_var::string_dup() instead of CORBA::string_dup(). But I am still =
getting error in client program. My client program is very simple, which is=
 like this</FONT></P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>TestSequence_=
var object =3D TestSequence::_narrow(tmp_ref);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(object =3D=3D TestSequence::_nil()){</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cout &lt;&lt; &quot;Failed=
 to get object&quot; &lt;&lt;endl;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; return 1;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; </FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>cout &lt;&lt;=
 &quot;Calling TestSequence::ReturnAdds&quot; &lt;&lt;endl;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddList_var add;</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; add =3D object-&gt;ReturnAdds();</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; cout &lt;&lt; &quot;Result :=3D &quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt; add[0].name=
 &lt;&lt; &quot; &quot;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; &lt;&lt; add[1].name &lt;&lt; &quot; &quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt; add[2].name=
 &lt;&lt; &quot; &quot;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; &lt;&lt;endl;</FONT>
</P>

<P><FONT SIZE=3D2>But when this AddList_var releases its memory it crip. </=
FONT>
</P>

<P><FONT SIZE=3D2>After doing some debugging of both server and client I ha=
ve got to know that I am getting error in the deallocation of string data t=
ype. (AddList is unbounded sequence of struct Address, which contains one m=
ember *name* of string data type). It seems to be that there is problem in =
&quot;void _CORBA_String_member::operator &lt;&lt;=3D (NetBufferedStream&am=
p; s)&quot; method. (This method is called by client stub code)</FONT></P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>void _CORBA_St=
ring_member::operator &lt;&lt;=3D (NetBufferedStream&amp; s)</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>{</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; if( _ptr &amp;&amp; _ptr !=3D omni::em=
pty_string )&nbsp; omni::freeString(_ptr);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; _ptr =3D 0;</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; CORBA::ULong len;</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; <FONT SIZE=3D2>//********************************************=
********</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>//****here it takes number of character to al=
locate********/</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>//*******************************************=
*********</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; len &lt;&lt;=3D s;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; if( !len &amp;&amp; omniORB::traceLeve=
l &gt; 1 )&nbsp; _CORBA_null_string_ptr(1);</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; CORBA::ULong nbytes =3D len ? len : 1;<=
/FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>//*******************************************=
*********</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>//****but here it actaully allocates len -1 c=
haracters********/</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>//*******************************************=
*********</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; char* p =3D omni::allocString(nbytes -=
 1);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; if( !p )&nbsp; OMNIORB_THROW(NO_MEMORY=
,0, CORBA::COMPLETED_MAYBE);</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; if( len ) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&n=
bsp;&nbsp;&nbsp; try {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; s.get_char_array((CORBA::Char*)p, len);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; if( p[len - 1] !=3D '\0' )</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OMNIORB_THROW(MARSHAL,0, CORBA::CO=
MPLETED_MAYBE);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&n=
bsp;&nbsp;&nbsp; }</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&n=
bsp;&nbsp;&nbsp; catch(...) {</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; omni::freeString(p);</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; throw;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&n=
bsp;&nbsp;&nbsp; }</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; }</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; else&nbsp; *p =3D '\0';</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; <FONT SIZE=3D2>&nbsp; _ptr =3D p;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>}</FONT>
</P>

<P><FONT SIZE=3D2>So if my string is of 4 characters then *len* would be 5,=
 but actual allocation would be of 4 chars, which actually has to be &quot;=
4+1&quot;. </FONT></P>

<P><FONT SIZE=3D2>Well this is my investigation.......may be I could be wro=
ng. If any body has clew please let me know.</FONT>
</P>

<P><FONT SIZE=3D2>Thanks for every body for there help.</FONT>
</P>

<P><FONT SIZE=3D2>Regards,</FONT>
</P>

<P><FONT SIZE=3D2>Sanjay Murudkar</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Rajshekhar Kishtaiah Chintapalli</FONT>
<BR><FONT SIZE=3D2>[<A HREF=3D"mailto:rajshekhar.chintapalli@wipro.com">mai=
lto:rajshekhar.chintapalli@wipro.com</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Wednesday, February 28, 2001 10:43 AM</FONT>
<BR><FONT SIZE=3D2>To: sanjaymu@mastek.com</FONT>
<BR><FONT SIZE=3D2>Cc: omniorb-list@uk.research.att.com</FONT>
<BR><FONT SIZE=3D2>Subject: Re: [omniORB] Need help for memory access viola=
tion for</FONT>
<BR><FONT SIZE=3D2>unboundedsequence</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Hi Sanjay,</FONT>
</P>

<P><FONT SIZE=3D2>Just check if you are compling using Single threaded libr=
aries . Make it</FONT>
<BR><FONT SIZE=3D2>Multithreaded threaded libraries instead under&nbsp; the=
 C./C++ tab , option</FONT>
<BR><FONT SIZE=3D2>code generation&nbsp; in the project settings under usin=
g run time libraries.</FONT>
</P>

<P><FONT SIZE=3D2>Your problem most likely is because of that.</FONT>
</P>

<P><FONT SIZE=3D2>Cheers</FONT>
<BR><FONT SIZE=3D2>Raj</FONT>
</P>

<P><FONT SIZE=3D2>sanjaymu@mastek.com wrote:</FONT>
</P>

<P><FONT SIZE=3D2>&gt;&nbsp; Hi,(&quot;I think you should duplicate the obj=
ect before returning it&quot;) I</FONT>
<BR><FONT SIZE=3D2>&gt; am returning unbounded sequence and not CORBA objec=
t. Hence the data</FONT>
<BR><FONT SIZE=3D2>&gt; has to be returned as by value. Interestingly, I am=
 able receive</FONT>
<BR><FONT SIZE=3D2>&gt; expected data in my client program but after that s=
ever crashes while</FONT>
<BR><FONT SIZE=3D2>&gt; releasing memory. Also on client side when the rece=
ived data gets</FONT>
<BR><FONT SIZE=3D2>&gt; released it also result in memory access violation.=
Regards,</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; Sanjay Murudkar</FONT>
<BR><FONT SIZE=3D2>&gt; Ext. 1493</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -----Original Message=
-----</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From: Andreas Eglseer=
 - Entwicklung</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [<A HREF=3D"mailto:an=
dreas.eglseer@lisec.com">mailto:andreas.eglseer@lisec.com</A>]</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent: Tuesday, Februa=
ry 27, 2001 8:12 PM</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To: sanjaymu@mastek.c=
om</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Subject: AW: [omniORB=
] Need help for memory access violation</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for unbounded sequenc=
e</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HiI think you should =
duplicate the object before returning</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it, because the memor=
y gets automatically freed, when the</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function ends.Cheers,=
Andreas</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; -----Urspr=FCngliche Nachricht-----</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; Von: owner-omniorb-list@uk.research.att.com</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; [<A HREF=3D"mailto:owner-omniorb-list@uk.research.att.com">mailto:=
owner-omniorb-list@uk.research.att.com</A>]Im</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; Auftrag von sanjaymu@mastek.com</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; Gesendet am: Dienstag, 27. Februar 2001 15:18</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; An: omniorb-list@uk.research.att.com</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; Betreff: [omniORB] Need help for memory access</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; violation for unbounded sequenceHi,I have written</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; simple program based on sequence&lt;&gt;. My sample</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; CORBA component has onem ethod ReturnAdds() which</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; returns a AddList object which is actually an</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; unbounded sequence of Address struct. My IDL</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; definition is as follows:</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct Address</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string name;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }; typedef sequence&lt;Address&gt;</=
FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddList; interface TestSequence</FON=
T>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddList ReturnAdds();</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; My implementation of ReturnAdds is as follows:</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddList* TestSequence_i::ReturnAdds(=
)</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp; cout &lt;&lt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;TestSequenceImpl::ReturnAdds()=
:</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; called.&quot; &lt;&lt; endl;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp; AddList* _result;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; _result =3D new AddList(3); //</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; allocate memory</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp; _result-&gt;length(3);</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i =
=3D 0;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*_res=
ult)[i++].name =3D</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::string_dup(&quot;Sanjay&quot;=
);</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*_res=
ult)[i++].name =3D</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::string_dup(&quot;Shankar&quot=
;);</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (*_res=
ult)[i++].name =3D</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::string_dup(&quot;Murudkar&quo=
t;);</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout &lt;&lt; &quot;TestSequenceImpl=
::ReturnAdds():</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; returning...&quot; &lt;&lt; endl;</F=
ONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return _resu=
lt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; Well I go through my implemented method but the</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; server stub code of the ReturnAdds() method gives</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; me memory access violation. I feel that the code</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; which I have written is right one as it worksp</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; roperly on Orbix2000 1.1.</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; BTW I am using VC++ 6.0 Windows 2000 with VS SP3.</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; Can anybody help me in finding out what problem I</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; am getting.</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; Regards,</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; Sanjay Murudkar</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; Ext. 1493</FONT>
</P>

<CODE><FONT SIZE=3D3><BR>
<BR>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>
Opinions expressed in this e-mail are those of the individual and not that =
of Mastek Limited, unless specifically indicated to that effect. Mastek Lim=
ited does not accept any responsibility or liability for it.<BR>
<BR>
This e-mail and attachments (if any) transmitted with it are confidential a=
nd/or privileged and solely for the use of the intended person or entity to=
 which it is addressed.<BR>
<BR>
Any review, re-transmission, dissemination or other use of or taking of any=
 action in reliance upon this information by persons or entities other than=
 the intended recipient is prohibited.<BR>
<BR>
This e-mail and its attachments have been scanned for the presence of compu=
ter viruses. It is the responsibility of the recipient to run the virus che=
ck on e-mails and attachments before opening them.<BR>
<BR>
If you have received this e-mail in error, kindly delete this e-mail from a=
ll computers and please contact the sender on +91-22-829 0635.<BR>
<BR>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>
</FONT></CODE></BODY>
</HTML>
------_=_NextPart_001_01C0A16B.677446A0--