[prev in list] [next in list] [prev in thread] [next in thread] 

List:       axis-c-user
Subject:    Memory Leak?
From:       "Tomaz Rotovnik" <tomaz.rotovnik () uni-mb ! si>
Date:       2005-10-26 16:04:26
Message-ID: 000c01c5da46$f05deb60$390308a4 () gandalf
[Download RAW message or body]

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


[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 6.00.2900.2769" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I'm using axis 1.5 C++. </FONT><FONT face=Arial 
size=2>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.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>For example WSDL2XML generated this parts of 
code</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Parameters that will be send over the 
web</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;m_pCall-&gt;addParameter((void*)&amp;Value0, 
"lTerminalID", XSD_LONG);<BR>&nbsp;m_pCall-&gt;addParameter((void*)Value1, 
"sMSISDN", XSD_STRING);<BR>&nbsp;m_pCall-&gt;addParameter((void*)&amp;Value2, 
"dAmount", XSD_DOUBLE);<BR>&nbsp;</FONT></DIV>
<DIV><FONT face=Arial size=2>We expect next received parameters:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>xsd__string sBlpType;<BR>xsd__double 
dAmount;<BR>xsd__string lTransactionID;<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Where and How can I&nbsp;delete memory for this 
parameters?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Return function is something like that</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>MPBLPSoap::AddPoints(xsd__long Value0, xsd__string 
Value1, xsd__double Value2){</FONT></DIV>
<DIV><FONT face=Arial size=2>...</FONT></DIV>
<DIV><FONT face=Arial size=2>pReturn = 
(setReturnAddPointsParameter*)m_pCall-&gt;getCmplxObject((void*) 
Axis_DeSerialize_setReturnAddPointsParameter, (void*) 
Axis_Create_setReturnAddPointsParameter, (void*) 
Axis_Delete_setReturnAddPointsParameter,"AddPointsResult", 
0);<BR>...</FONT></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>and this is part of calling statement:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>setReturnAddPointsParameter* pRAPP = 
NULL;</FONT></DIV>
<DIV><FONT face=Arial size=2>MPBLPSoap pBLP_authorize(sMPG.strURL.c_str(), 
APTHTTP1_1);<BR>pBLP_authorize.Timeout(sMPG.iHTTPTimeoutSec);</FONT></DIV>
<DIV><FONT face=Arial size=2>pRAPP = 
pBLP_authorize.AddPoints(1,sTr.szMSISDN,sTr.dAmount);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>After successful operation I call </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>free(pRAPP)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>but unfortunately I still get memory leak. I 
checked with Trial version of IBM PurifyPlus and it suspects that&nbsp;memory 
leak exists because of unallocated parameters :</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>m_pCall-&gt;addParameter((void*)Value1, "sMSISDN", 
XSD_STRING);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>xsd__string sBlpType;<BR>xsd__double 
dAmount;<BR>xsd__string lTransactionID;</FONT><BR></DIV>
<DIV><FONT face=Arial size=2>I also checked what calling free do: It erases 
the&nbsp;pointers (they become undefined), so they are de-allocated 
right?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>But memory is still growing with each transaction 
and Purify always shows on the same problem. </FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT><BR></DIV>
<DIV><FONT face=Arial size=2>I also find out that new char is created when 
calling 
<DIV><FONT face=Arial size=2>m_pCall-&gt;addParameter((void*)Value1, "sMSISDN", 
XSD_STRING);</FONT></DIV>
<DIV>so when is this array deleted?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Any suggestions are welcome.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Tomaz</DIV>
<DIV>&nbsp;</DIV></FONT></DIV></BODY></HTML>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic