axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kelly, Niall" <Niall.Ke...@ie.fid-intl.com>
Subject RE: Destruction of ArrayBean -- Memory Leak?
Date Wed, 09 Aug 2006 07:36:45 GMT
Hi,

As a follow-up to yesterday's mail, I've created a new issue on JIRA in
relation to the client-side memory leak.

http://issues.apache.org/jira/browse/AXISCPP-989

Regards,
Niall.

-----Original Message-----
From: Kelly, Niall [mailto:Niall.Kelly@ie.fid-intl.com] 
Sent: Tuesday, August 08, 2006 6:07 PM
To: 'axis-c-user@ws.apache.org'
Cc: 'adrian.dick@uk.ibm.com'; 'yuan@formtrap.com'
Subject: Re: Destruction of ArrayBean -- Memory Leak?


Hi, 
I have encountered memory leaks (reported by Purify (on Solaris) and
Valgrind (on Linux)) in an AXIS C++ Client application. The leaks are
associated with a clone of an array object (created by the
SoapSerializer::addOutputCmplxArrayParam method). The cloned object is used
to call makeArrayBean after which the clone is "de-coupled" -- i.e its
internal m_Size and m_Array fields are reset before it is destroyed. I
understand that the idea of this is that the clone object itself is cleaned
up and the ArrayBean object takes ownership of the internal array.
After the Web-service operation has been invoked, the ArrayBean destructor
will eventually be called. In the destructor a number of checks are made
(see below) before the appropriate delete-function (in generated stub)  is
made. As earlier raised by Yuan Liu, why is this delete function not invoked
for client side AXIS C++ apps? (If I remove the check for
AxisEngine::m_bServer in the ArrayBean destructor the tools I use no longer
report leaks for my application).
Should this change be made to the AXIS C++ source or are there potential
issues with allowing this delete on client-side?
Regards, 
Niall. 
    // Extract from ~ArrayBean 
    if (USER_TYPE == m_type) 
    { 
        if (m_value.cta) 
        { 
            if (m_value.cta->pObject) 
            { 
              if (AxisEngine::m_bServer) 
                { 
                    m_value.cta->pDelFunct(m_value.cta->pObject, true,
m_nSize); 
                } 
                // make sure that the ComplexObjectHandler's destructor does

                // not try to delete the objects again 
                m_value.cta->pObject = NULL; 
            } 
            delete m_value.cta; 
            m_value.cta = NULL; 
        } 
    } 
         -----Original Message----- 
        Hi, 
        
        I just want to know is there a reason why ArrayBeans are only
deleted on the 
        Server as the destructor contains codes like "if
(AxisEngine::m_bServer)". 
        At the moment, the client is leaking memory whenever it calls 
        "addOutputBasicArrayParam" (SoapSerializer.cpp) which create an
ArrayBean 
        with reference to an allocated block of Axis_Array. The ArrayBean is
deleted 
        correctly on server side but client side it is not deleted. 
        
        Thanks for all the good work. 
        
        Regards, 
        
        Yuan Liu 

Mime
View raw message