You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Dushshantha Chandradasa <dc...@virtusa.com> on 2005/09/20 05:19:47 UTC
Why do we use Virtual destructors [ [jira] Commented: (AXISCPP-343) SIGSEGV deserializing an array of complex elements]
Hi All,
Could somebody please explain why do we use a virtual destructor in
complex type auto generated classes for RPC style?
Thanks,
Dushshantha
-----Original Message-----
From: Dushshantha Chandradasa (JIRA) [mailto:axis-c-dev@ws.apache.org]
Sent: Friday, September 16, 2005 11:49 AM
To: axis-c-dev@ws.apache.org
Subject: [jira] Commented: (AXISCPP-343) SIGSEGV deserializing an array
of complex elements
[
http://issues.apache.org/jira/browse/AXISCPP-343?page=comments#action_12
329513 ]
Dushshantha Chandradasa commented on AXISCPP-343:
-------------------------------------------------
Hi Mark,
why do we use a memset here?? And why we use a virtual destructor here
in RPC??
> SIGSEGV deserializing an array of complex elements
> --------------------------------------------------
>
> Key: AXISCPP-343
> URL: http://issues.apache.org/jira/browse/AXISCPP-343
> Project: Axis-C++
> Type: Bug
> Components: Serialization
> Versions: 1.4 Final
> Environment: RH9
> Reporter: Unai Uribarri
> Assignee: Dushshantha Chandradasa
> Attachments: siaam.wsdl
>
> The function Axis_Create_* (in the following example, the mapItem
> object) in the stubs generated by wsdl2ws java tool generates a
SIGSEGV
> when tring to enlarge an array of objects
> mapItem* pNew = new mapItem[nSize];
> memcpy(pNew, pObj, sizeof(mapItem)*nSize/2);
> memset(pObj, 0, sizeof(mapItem)*nSize/2);
> --> delete [] pObj; <-- SIGSEGV
> memset clears the virtual table pointer of the mapItem objects and the
delete operator crash.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
Re: Why do we use Virtual destructors [ [jira] Commented: (AXISCPP-343)
SIGSEGV deserializing an array of complex elements]
Posted by Samisa Abeysinghe <sa...@gmail.com>.
Dushshantha Chandradasa wrote:
>Hi All,
>Could somebody please explain why do we use a virtual destructor in
>complex type auto generated classes for RPC style?
>
>
In my understanding, it is not a problem to use the virtual destructors.
But the problem is that we use both memset, followed by delete[] on the
same object.
I think we got to do only one of those and see if there are memory leaks.
using delete[] without memset and checking for leaks would reveal
whether delete[] alone would take care of memory cleaning.
Thanks,
Samisa...
>Thanks,
>Dushshantha
>
>-----Original Message-----
>From: Dushshantha Chandradasa (JIRA) [mailto:axis-c-dev@ws.apache.org]
>Sent: Friday, September 16, 2005 11:49 AM
>To: axis-c-dev@ws.apache.org
>Subject: [jira] Commented: (AXISCPP-343) SIGSEGV deserializing an array
>of complex elements
>
> [
>http://issues.apache.org/jira/browse/AXISCPP-343?page=comments#action_12
>329513 ]
>
>Dushshantha Chandradasa commented on AXISCPP-343:
>-------------------------------------------------
>
>Hi Mark,
>
>why do we use a memset here?? And why we use a virtual destructor here
>in RPC??
>
>
>
>>SIGSEGV deserializing an array of complex elements
>>--------------------------------------------------
>>
>> Key: AXISCPP-343
>> URL: http://issues.apache.org/jira/browse/AXISCPP-343
>> Project: Axis-C++
>> Type: Bug
>> Components: Serialization
>> Versions: 1.4 Final
>> Environment: RH9
>> Reporter: Unai Uribarri
>> Assignee: Dushshantha Chandradasa
>> Attachments: siaam.wsdl
>>
>>The function Axis_Create_* (in the following example, the mapItem
>>object) in the stubs generated by wsdl2ws java tool generates a
>>
>>
>SIGSEGV
>
>
>>when tring to enlarge an array of objects
>> mapItem* pNew = new mapItem[nSize];
>> memcpy(pNew, pObj, sizeof(mapItem)*nSize/2);
>> memset(pObj, 0, sizeof(mapItem)*nSize/2);
>> --> delete [] pObj; <-- SIGSEGV
>>memset clears the virtual table pointer of the mapItem objects and the
>>
>>
>delete operator crash.
>
>
>