[omniORB] Need help for memory access violation for unbounded
sequence
sanjaymu@mastek.com
sanjaymu@mastek.com
Wed, 28 Feb 2001 10:33:32 +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_01C0A143.CC2A0300
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
=20
("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,=20
Sanjay Murudkar=20
Ext. 1493=20
-----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
Hi
=20
I think you should duplicate the object before returning it, because the
memory gets automatically freed, when the function ends.
=20
Cheers,
=20
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
sequence
Hi,
=20
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;
};
=20
typedef sequence<Address> AddList;
=20
interface TestSequence
{
AddList ReturnAdds();
};
=20
My implementation of ReturnAdds is as follows:
AddList* TestSequence_i::ReturnAdds()
{
cout << "TestSequenceImpl::ReturnAdds(): called." << endl;
AddList* _result;
=20
_result =3D new AddList(3); // allocate memory
_result->length(3);
=20
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");
=20
cout << "TestSequenceImpl::ReturnAdds(): returning..." << endl;
return _result;
}
=20
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,=20
Sanjay Murudkar=20
Ext. 1493=20
=20
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that
of Mastek Limited, unless specifically indicated to that effect. Mastek
Limited does not accept any responsibility or liability for it.
This e-mail and attachments (if any) transmitted with it are confidential
and/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
computer viruses. It is the responsibility of the recipient to run the virus
check on e-mails and attachments before opening them.
If you have received this e-mail in error, kindly delete this e-mail from
all computers and please contact the sender on +91-22-829 0635.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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_01C0A143.CC2A0300
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3DISO-8859-=
1">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D603464204-28022001>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D603464204-28022001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D603464204-28022001>("<SPAN class=3D450363914-27022001><FONT face=3D=
Arial=20
color=3D#0000ff size=3D2>I think you should duplicate the object before ret=
urning=20
it") </FONT></SPAN></SPAN></FONT><FONT face=3DArial color=3D#0000ff size=3D=
2><SPAN=20
class=3D603464204-28022001>I am returning unbounded sequence and not C=
ORBA=20
object. Hence the data has to be returned as by value. Interestingly, =
I am=20
able receive expected data in my client program but after that=20
sever crashes while releasing memory. Also on client side when th=
e=20
received data gets released it also result in memory access=20
violation.</SPAN></FONT></DIV>
<P><FONT face=3DArial size=3D2>Regards,</FONT> </P>
<P><FONT face=3DArial size=3D2>Sanjay Murudkar</FONT> <BR><FONT face=3DAria=
l=20
size=3D2>Ext. 1493</FONT> </P>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT face=3DTah=
oma=20
size=3D2>-----Original Message-----<BR><B>From:</B> Andreas Eglseer -=20
Entwicklung [mailto:andreas.eglseer@lisec.com]<BR><B>Sent:</B> Tuesday,=
February 27, 2001 8:12 PM<BR><B>To:</B> sanjaymu@mastek.com<BR><B>Subject=
:</B>=20
AW: [omniORB] Need help for memory access violation for unbounded=20
sequence<BR><BR></FONT></DIV>
<DIV><SPAN class=3D450363914-27022001><FONT face=3DArial color=3D#0000ff=
size=3D2>Hi</FONT></SPAN></DIV>
<DIV><SPAN class=3D450363914-27022001><FONT face=3DArial color=3D#0000ff=
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D450363914-27022001><FONT face=3DArial color=3D#0000ff =
size=3D2>I=20
think you should duplicate the object before returning it, because the me=
mory=20
gets automatically freed, when the function ends.</FONT></SPAN></DIV>
<DIV><SPAN class=3D450363914-27022001><FONT face=3DArial color=3D#0000ff=
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D450363914-27022001><FONT face=3DArial color=3D#0000ff=
size=3D2>Cheers,</FONT></SPAN></DIV>
<DIV><SPAN class=3D450363914-27022001><FONT face=3DArial color=3D#0000ff=
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D450363914-27022001><FONT face=3DArial color=3D#0000ff=
size=3D2>Andreas</FONT></SPAN></DIV>
<BLOCKQUOTE>
<DIV><FONT face=3D"Times New Roman" size=3D2>-----Urspr=FCngliche=20
Nachricht-----<BR><B>Von:</B> owner-omniorb-list@uk.research.att.com=20
[mailto:owner-omniorb-list@uk.research.att.com]<B>Im Auftrag von</B>=20
sanjaymu@mastek.com<BR><B>Gesendet am:</B> Dienstag, 27. Februar 2001=
15:18<BR><B>An:</B> omniorb-list@uk.research.att.com<BR><B>Betreff:</B>=
[omniORB] Need help for memory access violation for unbounded=20
sequence<BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D706375113-27022001>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D706375113-27022001></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D706375113-27022001>I hav=
e written=20
simple program based on sequence<>. My sample CORBA component has=
onem=20
ethod ReturnAdds() which returns a AddList object which is actually an=
unbounded sequence of Address struct. My IDL definition is as=20
follows:</SPAN></FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial size=3D2><SPAN class=3D706375113-27022001>str=
uct=20
Address<BR>{<BR> string name;<BR>};</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D706375113-27022001>typ=
edef=20
sequence<Address> AddList;</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D706375113-27022001>int=
erface=20
TestSequence<BR>{<BR> AddList ReturnAdds();<BR>};</SPAN></FONT><=
/DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D706375113-27022001></SPAN></FONT> </DIV></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2><SPAN class=3D706375113-2702=
2001>My=20
implementation of ReturnAdds is as follows:</SPAN></FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV dir=3Dltr><FONT face=3DArial size=3D2><SPAN=20
class=3D706375113-27022001> AddList*=20
TestSequence_i::ReturnAdds()</SPAN></FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2><SPAN=20
class=3D706375113-27022001>{<BR> &=
nbsp; =20
cout << "TestSequenceImpl::ReturnAdds(): called." <<=20
endl;<BR> AddList*=20
_result;</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D706375113-27022001></SPAN></FONT> </DIV>
<DIV><SPAN class=3D706375113-27022001><FONT face=3DArial=20
size=3D2> _result =3D new AddList=
(3); //=20
allocate=20
memory<BR> _result->=
;length(3);<BR> <BR> in=
t=20
i =3D 0;<BR> (*_result)[i++].name =3D=20
CORBA::string_dup("Sanjay");<BR> (*_resu=
lt)[i++].name=20
=3D=20
CORBA::string_dup("Shankar");<BR> (*_res=
ult)[i++].name=20
=3D CORBA::string_dup("Murudkar");</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV dir=3Dltr><FONT face=3DArial size=3D2> <S=
PAN=20
class=3D706375113-27022001> </SPAN>cout <&l=
t;=20
"TestSequenceImpl::ReturnAdds(): returning..." << endl;<BR><SPA=
N=20
class=3D706375113-27022001> </SPAN>  =
; =20
return _result;<BR>}</FONT></DIV>
<DIV dir=3Dltr></SPAN><SPAN class=3D706375113-27022001><FONT face=3DA=
rial=20
size=3D2></FONT></SPAN> </DIV></BLOCKQUOTE>
<DIV dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><SPAN class=3D706375113-2702=
2001><FONT=20
face=3DArial size=3D2>Well I go through my implemented method but =
the=20
server stub code of the ReturnAdds() method gives me memory access=
violation. I feel that the code which I have written is right=
one=20
as it worksp roperly on Orbix2000 1.1.</FONT></SPAN></DIV>
<DIV dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><SPAN class=3D706375113-2702=
2001><FONT=20
face=3DArial size=3D2>BTW I am using VC++ 6.0 Windows 2000 with VS SP3.=
Can=20
anybody help me in finding out what problem I am=20
getting.</FONT></SPAN></DIV>
<P><FONT face=3DArial size=3D2>Regards,</FONT> </P>
<P><FONT face=3DArial size=3D2>Sanjay Murudkar</FONT> <BR><FONT face=3D=
Arial=20
size=3D2>Ext. 1493</FONT> </P>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV><CODE><FONT=20
size=3D3><BR><BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>Opinions=20
expressed in this e-mail are those of the individual and not that of Ma=
stek=20
Limited, unless specifically indicated to that effect. Mastek Limited d=
oes=20
not accept any responsibility or liability for it.<BR><BR>This e-mail a=
nd=20
attachments (if any) transmitted with it are confidential and/or privil=
eged=20
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 u=
se of=20
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=20
and its attachments have been scanned for the presence of computer viru=
ses.=20
It is the responsibility of the recipient to run the virus check on e-m=
ails=20
and attachments before opening them.<BR><BR>If you have received this e=
-mail=20
in error, kindly delete this e-mail from all computers and please conta=
ct=20
the sender on +91-22-829=20
0635.<BR><BR>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR></BLOCKQUOTE></BLOC=
KQUOTE></FONT></CODE><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_01C0A143.CC2A0300--