axis-c-user mailing list archives

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

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


-----Original Message-----
From: Kelly, Niall [] 
Sent: Tuesday, August 08, 2006 6:07 PM
To: ''
Cc: ''; ''
Subject: Re: Destruction of ArrayBean -- Memory Leak?

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?
    // 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,
                // 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----- 
        I just want to know is there a reason why ArrayBeans are only
deleted on the 
        Server as the destructor contains codes like "if
        At the moment, the client is leaking memory whenever it calls 
        "addOutputBasicArrayParam" (SoapSerializer.cpp) which create an
        with reference to an allocated block of Axis_Array. The ArrayBean is
        correctly on server side but client side it is not deleted. 
        Thanks for all the good work. 
        Yuan Liu 

View raw message