[omniORB] Need help for memory access violation for unboundedsequence

Rajshekhar Kishtaiah Chintapalli rajshekhar.chintapalli@wipro.com
Wed, 28 Feb 2001 10:42:31 +0530


--------------BD3CD7FE7312E58C74D081FA
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by suraksha.wipro.com id KAA15261

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
>           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 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.
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--------------BD3CD7FE7312E58C74D081FA
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi Sanjay,
<p>Just check if you are compling using Single threaded libraries . Make
it Multithreaded threaded libraries instead under&nbsp; the C./C++ tab
, option code generation&nbsp; in the project settings under using run
time libraries.
<br>Your problem most likely is because of that.
<p>Cheers
<br>Raj
<p>sanjaymu@mastek.com wrote:
<blockquote TYPE=CITE>&nbsp;<span 
class=603464204-28022001><font face="Arial"><font color="#0000FF"><font size=-1>Hi,</font></font></font></span><span 
class=603464204-28022001></span><span 
class=603464204-28022001><font face="Arial"><font color="#0000FF"><font size=-1>("<span class=450363914-27022001>I
think you should duplicate the object before returning it")&nbsp;</span></span><span 
class=603464204-28022001>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.</font></font></font></span><font face="Arial"><font size=-1>Regards,</font></font>
<p><font face="Arial"><font size=-1>Sanjay Murudkar</font></font>
<br><font face="Arial"><font size=-1>Ext. 1493</font></font>
<blockquote dir=ltr style="MARGIN-RIGHT: 0px">
<div class="OutlookMessageHeader" dir="ltr"><font face="Tahoma"><font size=-1>-----Original
Message-----</font></font>
<br><font face="Tahoma"><font size=-1><b>From:</b> Andreas Eglseer - Entwicklung
[<A HREF="mailto:andreas.eglseer@lisec.com">mailto:andreas.eglseer@lisec.com</A>]</font></font>
<br><font face="Tahoma"><font size=-1><b>Sent:</b> Tuesday, February 27,
2001 8:12 PM</font></font>
<br><font face="Tahoma"><font size=-1><b>To:</b> sanjaymu@mastek.com</font></font>
<br><font face="Tahoma"><font size=-1><b>Subject:</b> AW: [omniORB] Need
help for memory access violation for unbounded sequence</font></font>
<br>&nbsp;</div>
<span class=450363914-27022001><font face="Arial"><font color="#0000FF"><font size=-1>Hi</font></font></font></span><span class=450363914-27022001></span><span class=450363914-27022001><font face="Arial"><font color="#0000FF"><font size=-1>I
think you should duplicate the object before returning it, because the
memory gets automatically freed, when the function ends.</font></font></font></span><span class=450363914-27022001></span><span class=450363914-27022001><font face="Arial"><font color="#0000FF"><font size=-1>Cheers,</font></font></font></span><span class=450363914-27022001></span><span class=450363914-27022001><font face="Arial"><font color="#0000FF"><font size=-1>Andreas</font></font></font></span>
<blockquote><font face="Times New Roman"><font size=-1>-----Urspr&uuml;ngliche
Nachricht-----</font></font>
<br><font face="Times New Roman"><font size=-1><b>Von:</b> owner-omniorb-list@uk.research.att.com
[<A HREF="mailto:owner-omniorb-list@uk.research.att.com">mailto:owner-omniorb-list@uk.research.att.com</A>]<b>Im Auftrag von</b> sanjaymu@mastek.com</font></font>
<br><font face="Times New Roman"><font size=-1><b>Gesendet am:</b> Dienstag,
27. Februar 2001 15:18</font></font>
<br><font face="Times New Roman"><font size=-1><b>An:</b> omniorb-list@uk.research.att.com</font></font>
<br><font face="Times New Roman"><font size=-1><b>Betreff:</b> [omniORB]
Need help for memory access violation for unbounded sequence</font></font><span 
    class=706375113-27022001><font face="Arial"><font size=-1>Hi,</font></font></span><span 
    class=706375113-27022001></span><span class=706375113-27022001><font face="Arial"><font size=-1>I
have written simple program based on sequence&lt;>. 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:</font></font></span>
<blockquote dir=ltr style="MARGIN-RIGHT: 0px"><span class=706375113-27022001><font face="Arial"><font size=-1>struct
Address</font></font>
<br><font face="Arial"><font size=-1>{</font></font>
<br><font face="Arial"><font size=-1>&nbsp;string name;</font></font>
<br><font face="Arial"><font size=-1>};</font></font></span>&nbsp;<span class=706375113-27022001><font face="Arial"><font size=-1>typedef
sequence&lt;Address> AddList;</font></font></span>&nbsp;<span class=706375113-27022001><font face="Arial"><font size=-1>interface
TestSequence</font></font>
<br><font face="Arial"><font size=-1>{</font></font>
<br><font face="Arial"><font size=-1>&nbsp;AddList ReturnAdds();</font></font>
<br><font face="Arial"><font size=-1>};</font></font></span><span 
      class=706375113-27022001></span></blockquote>

<div dir=ltr><span class=706375113-27022001><font face="Arial"><font size=-1>My
implementation of ReturnAdds is as follows:</font></font></span></div>

<blockquote dir=ltr style="MARGIN-RIGHT: 0px">
<div dir=ltr><span 
      class=706375113-27022001><font face="Arial"><font size=-1>
AddList* TestSequence_i::ReturnAdds()</font></font></span></div>

<div dir=ltr><span 
      class=706375113-27022001><font face="Arial"><font size=-1>{</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
cout &lt;&lt; "TestSequenceImpl::ReturnAdds(): called." &lt;&lt; endl;</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
AddList* _result;</font></font></span></div>
<span 
      class=706375113-27022001></span><span class=706375113-27022001><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_result = new AddList(3); // allocate memory</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_result->length(3);</font></font>
<p><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp; int i = 0;</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp; (*_result)[i++].name
= CORBA::string_dup("Sanjay");</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp; (*_result)[i++].name
= CORBA::string_dup("Shankar");</font></font>
<br><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp; (*_result)[i++].name
= CORBA::string_dup("Murudkar");</font></font>&nbsp;
<div dir=ltr><span 
      class=706375113-27022001></span><font face="Arial"><font size=-1>cout
&lt;&lt; "TestSequenceImpl::ReturnAdds(): returning..." &lt;&lt; endl;</font></font>
<br><span 
      class=706375113-27022001></span><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;
return _result;</font></font>
<br><font face="Arial"><font size=-1>}</font></font></div>

<div dir=ltr></span><span class=706375113-27022001></span></div>
</blockquote>

<div dir=ltr style="MARGIN-RIGHT: 0px"><span class=706375113-27022001><font face="Arial"><font size=-1>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.</font></font></span></div>

<div dir=ltr style="MARGIN-RIGHT: 0px"><span class=706375113-27022001><font face="Arial"><font size=-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.</font></font></span></div>
<font face="Arial"><font size=-1>Regards,</font></font>
<p><font face="Arial"><font size=-1>Sanjay Murudkar</font></font>
<br><font face="Arial"><font size=-1>Ext. 1493</font></font>&nbsp;
<p><tt><font size=+0>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</font></tt>
<br><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</font></tt></blockquote>
</blockquote>

<p><tt><font size=+0>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</font></tt>
<br><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>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.</font></tt>
<p><tt><font size=+0>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</font></tt></blockquote>
</html>

--------------BD3CD7FE7312E58C74D081FA--