Uploaded image for project: 'Axis-C++'
  1. Axis-C++
  2. AXISCPP-989

Memory leak in Clients after arrays are serialized

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.6 Final
    • None
    • Serialization
    • None
    • Observed on Linux and Solaris.

    Description

      When an array of elements is serialized on the client side prior to invoking an operation, memory is leaked.

      In the SoapSerializer::addOutputCmplxArrayParam method, the pArray argument is cloned (pLocalArray), after which the clone is used as an argument of makeArrayBean. The internal array associated with the clone is then "de-coupled" before pLocalArray is destroyed. At this point the new ArrayBean object assumes ownership for the array memory.

      At some point after serialization the ArrayBean object is destroyed. However it's constructor does not delete the memory associated with the array and the elements it contains. In the extract below from ~ArrayBean, the check for AxisEngine::m_bServer prevents the array from being deleted (for applications on the 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, 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;
      }
      }

      Perhaps this memory leak can be fixed by simple removing that check for AxisEngine::m_bServer and always invoking m_value.cta->pDelFunct (i.e. the appropriate genereted delete method..).

      Attachments

        Activity

          People

            nadiramra Nadir K. Amra
            ngkelly75 Niall Kelly
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: