axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomaz Rotovnik <tomaz.rotov...@uni-mb.si>
Subject Re: Memory Leak?
Date Thu, 27 Oct 2005 08:43:57 GMT
Hi Anders

I'm using Axis C client, but I suppose that the memory leaks are the same 
right? I already tried with putting delete statements into destructor 
classes but they are never called if I use free(pRAPP), where pRAPP is 
setReturnAddPointsParameter*. So should I use delete instead of free? I'm a 
little bit confused, because Management Guide about De-allocation Semantics 
talks about usage of free statements.

In case of deserialazing received parameters from web server I think that 
statement "new"  is used also for allocating basic types XSD_DOUBLE or 
XSD_LONG. If is this true then this should be also deleted in destructor, 
right?

Best regards

Tomaz


----- Original Message ----- 
From: "Anders Eriksson" <anderserikss0n@hotmail.com>
To: <axis-c-user@ws.apache.org>
Sent: Thursday, October 27, 2005 10:01 AM
Subject: RE: Memory Leak?


>
> Hi Tomaz,
>
> I have been looking in to the memory leaks in the Axis C server
> a bit.
>
> I found that in complex objects strings are not deleted. You can
> add the delete statments in your setReturnAddPointsParameter
> class destructor.
>
> Moreover there is a leak in in Apache1_3module (mod_axis.dll),
> in ApacheTransport.cpp where m_pBuffers is not deleted.
>
> I have been requested to do a svn patch but as I am not
> working on the lastest version I have not found the time to do
> this. I will do it as soon as I can...
>
> /Anders
>
>>From: "Tomaz Rotovnik" <tomaz.rotovnik@uni-mb.si>
>>Reply-To: "Apache AXIS C User List" <axis-c-user@ws.apache.org>
>>To: "Apache AXIS C User List" <axis-c-user@ws.apache.org>
>>Subject: Memory Leak?
>>Date: Wed, 26 Oct 2005 18:04:26 +0200
>>
>>Hi
>>
>>I'm using axis 1.5 C++. When I tested my client (multithreaded) I found 
>>out that memory is growing with number of transactions. I read Axis C++ 
>>Memory Management Guide about De-allocation Semantics.
>>
>>For example WSDL2XML generated this parts of code
>>
>>Parameters that will be send over the web
>>
>>  m_pCall->addParameter((void*)&Value0, "lTerminalID", XSD_LONG);
>>  m_pCall->addParameter((void*)Value1, "sMSISDN", XSD_STRING);
>>  m_pCall->addParameter((void*)&Value2, "dAmount", XSD_DOUBLE);
>>
>>We expect next received parameters:
>>
>>xsd__string sBlpType;
>>xsd__double dAmount;
>>xsd__string lTransactionID;
>>
>>Where and How can I delete memory for this parameters?
>>
>>Return function is something like that
>>
>>MPBLPSoap::AddPoints(xsd__long Value0, xsd__string Value1, xsd__double 
>>Value2){
>>...
>>pReturn = (setReturnAddPointsParameter*)m_pCall->getCmplxObject((void*) 
>>Axis_DeSerialize_setReturnAddPointsParameter, (void*) 
>>Axis_Create_setReturnAddPointsParameter, (void*) 
>>Axis_Delete_setReturnAddPointsParameter,"AddPointsResult", 0);
>>...
>>}
>>
>>and this is part of calling statement:
>>
>>setReturnAddPointsParameter* pRAPP = NULL;
>>MPBLPSoap pBLP_authorize(sMPG.strURL.c_str(), APTHTTP1_1);
>>pBLP_authorize.Timeout(sMPG.iHTTPTimeoutSec);
>>pRAPP = pBLP_authorize.AddPoints(1,sTr.szMSISDN,sTr.dAmount);
>>
>>After successful operation I call
>>
>>free(pRAPP)
>>
>>but unfortunately I still get memory leak. I checked with Trial version of 
>>IBM PurifyPlus and it suspects that memory leak exists because of 
>>unallocated parameters :
>>
>>m_pCall->addParameter((void*)Value1, "sMSISDN", XSD_STRING);
>>
>>xsd__string sBlpType;
>>xsd__double dAmount;
>>xsd__string lTransactionID;
>>
>>I also checked what calling free do: It erases the pointers (they become 
>>undefined), so they are de-allocated right?
>>
>>But memory is still growing with each transaction and Purify always shows 
>>on the same problem.
>>
>>
>>I also find out that new char is created when calling
>>m_pCall->addParameter((void*)Value1, "sMSISDN", XSD_STRING);
>>so when is this array deleted?
>>
>>Any suggestions are welcome.
>>
>>Tomaz
>
> _________________________________________________________________
> Senaste nytt från motormarknaden http://motor.msn.se/
> 


Mime
View raw message