You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Alex Akula (JIRA)" <xe...@xml.apache.org> on 2005/07/08 15:11:20 UTC
[jira] Created: (XERCESC-1455) Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
------------------------------------------------------------------------------------------------------------
Key: XERCESC-1455
URL: http://issues.apache.org/jira/browse/XERCESC-1455
Project: Xerces-C++
Type: Bug
Components: Utilities
Versions: 2.3.0
Environment: Solaris
Reporter: Alex Akula
When objects get removed from ValueVectorOf < object type> container no destructors are called for the objects. Amemory leak could result from this.
This could be fixed by changing the code:
template <class TElem> void ValueVectorOf<TElem>::
removeElementAt(const unsigned int removeAt)
{
if (removeAt >= fCurCount)
ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex);
fElemList[removeAt] = 0; // akula -- this is the fix for classes in which assign operator is overloaded appropriate way.
if (removeAt == fCurCount-1)
{
fCurCount--;
return;
}
// Copy down every element above remove point
for (unsigned int index = removeAt; index < fCurCount-1; index++)
fElemList[index] = fElemList[index+1];
// And bump down count
fCurCount--;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
[jira] Commented: (XERCESC-1455) Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
Posted by "David Bertoni (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESC-1455?page=comments#action_12316051 ]
David Bertoni commented on XERCESC-1455:
----------------------------------------
It's actually worse than this. This class is completely broken with respect to holding object instances by value. I'm going to work on a patch that limits the use of this class to PODs.
> Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
> ------------------------------------------------------------------------------------------------------------
>
> Key: XERCESC-1455
> URL: http://issues.apache.org/jira/browse/XERCESC-1455
> Project: Xerces-C++
> Type: Bug
> Components: Utilities
> Versions: 2.3.0
> Environment: Solaris
> Reporter: Alex Akula
> Assignee: David Bertoni
>
> When objects get removed from ValueVectorOf < object type> container no destructors are called for the objects. Amemory leak could result from this.
> This could be fixed by changing the code:
> template <class TElem> void ValueVectorOf<TElem>::
> removeElementAt(const unsigned int removeAt)
> {
> if (removeAt >= fCurCount)
> ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex);
> fElemList[removeAt] = 0; // akula -- this is the fix for classes in which assign operator is overloaded appropriate way.
> if (removeAt == fCurCount-1)
> {
> fCurCount--;
> return;
> }
> // Copy down every element above remove point
> for (unsigned int index = removeAt; index < fCurCount-1; index++)
> fElemList[index] = fElemList[index+1];
> // And bump down count
> fCurCount--;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://wwwFrom c-dev-return-23655-apmail-xerces-c-dev-archive=xerces.apache.org@xerces.apache.org Tue Jul 19 00:54:09 2005
Return-Path: <c-...@xerces.apache.org>
Delivered-To: apmail-xerces-c-dev-archive@www.apache.org
Received: (qmail 54312 invoked from network); 19 Jul 2005 00:54:07 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199)
by minotaur.apache.org with SMTP; 19 Jul 2005 00:54:07 -0000
Received: (qmail 67570 invoked by uid 500); 19 Jul 2005 00:54:04 -0000
Delivered-To: apmail-xerces-c-dev-archive@xerces.apache.org
Received: (qmail 67178 invoked by uid 500); 19 Jul 2005 00:54:03 -0000
Mailing-List: contact c-dev-help@xerces.apache.org; run by ezmlm
Precedence: bulk
List-Help: <ma...@xerces.apache.org>
List-Unsubscribe: <ma...@xerces.apache.org>
List-Post: <ma...@xerces.apache.org>
List-Id: <c-dev.xerces.apache.org>
Reply-To: c-dev@xerces.apache.org
Delivered-To: mailing list c-dev@xerc.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
es.apache.org
Received: (qmail 66776 invoked by uid 99); 19 Jul 2005 00:54:02 -0000
X-ASF-Spam-Status: No, hits=0.0 required=10.0
tests=SPF_FAIL
X-Spam-Check-By: apache.org
Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226)
by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2005 17:53:49 -0700
Received: from ajax.apache.org (ajax.apache.org [127.0.0.1])
by ajax.apache.org (Postfix) with ESMTP id 4E0E6E5
for <c-...@xerces.apache.org>; Tue, 19 Jul 2005 02:53:46 +0200 (CEST)
Message-ID: <20...@ajax.apache.org>
Date: Tue, 19 Jul 2005 02:53:46 +0200 (CEST)
From: "David Bertoni (JIRA)" <xe...@xml.apache.org>
To: c-dev@xerces.apache.org
Subject: [jira] Assigned: (XERCESC-1455) Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
In-Reply-To: <21...@ajax.apache.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N
[ http://issues.apache.org/jira/browse/XERCESC-1455?page=all ]
David Bertoni reassigned XERCESC-1455:
--------------------------------------
Assign To: David Bertoni
> Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
> ------------------------------------------------------------------------------------------------------------
>
> Key: XERCESC-1455
> URL: http://issues.apache.org/jira/browse/XERCESC-1455
> Project: Xerces-C++
> Type: Bug
> Components: Utilities
> Versions: 2.3.0
> Environment: Solaris
> Reporter: Alex Akula
> Assignee: David Bertoni
>
> When objects get removed from ValueVectorOf < object type> container no destructors are called for the objects. Amemory leak could result from this.
> This could be fixed by changing the code:
> template <class TElem> void ValueVectorOf<TElem>::
> removeElementAt(const unsigned int removeAt)
> {
> if (removeAt >= fCurCount)
> ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex);
> fElemList[removeAt] = 0; // akula -- this is the fix for classes in which assign operator is overloaded appropriate way.
> if (removeAt == fCurCount-1)
> {
> fCurCount--;
> return;
> }
> // Copy down every element above remove point
> for (unsigned int index = removeAt; index < fCurCount-1; index++)
> fElemList[index] = fElemList[index+1];
> // And bump down count
> fCurCount--;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
[jira] Closed: (XERCESC-1455) Template ValueVectorOf does not call
destructors for removing objects. A memory leak could result from this.
Posted by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XERCESC-1455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Boris Kolpackov closed XERCESC-1455.
------------------------------------
Resolution: Fixed
Fix Version/s: 3.0.1
I see that there is now the callDestructor flag in ValueVectorOf. So I assume this has been fixed (in an ugly way).
> Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
> ------------------------------------------------------------------------------------------------------------
>
> Key: XERCESC-1455
> URL: https://issues.apache.org/jira/browse/XERCESC-1455
> Project: Xerces-C++
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.3.0
> Environment: Solaris
> Reporter: Alex Akula
> Assignee: David Bertoni
> Fix For: 3.0.1
>
> Attachments: patch.txt
>
>
> When objects get removed from ValueVectorOf < object type> container no destructors are called for the objects. Amemory leak could result from this.
> This could be fixed by changing the code:
> template <class TElem> void ValueVectorOf<TElem>::
> removeElementAt(const unsigned int removeAt)
> {
> if (removeAt >= fCurCount)
> ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex);
> fElemList[removeAt] = 0; // akula -- this is the fix for classes in which assign operator is overloaded appropriate way.
> if (removeAt == fCurCount-1)
> {
> fCurCount--;
> return;
> }
> // Copy down every element above remove point
> for (unsigned int index = removeAt; index < fCurCount-1; index++)
> fElemList[index] = fElemList[index+1];
> // And bump down count
> fCurCount--;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
[jira] Updated: (XERCESC-1455) Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
Posted by "David Bertoni (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESC-1455?page=all ]
David Bertoni updated XERCESC-1455:
-----------------------------------
Attachment: patch.txt
This patch prohibits instantiating ValueVectorOf with a non-POD type, since the implementation does not support proper semantics for types with constructors, destructors, etc. There is very little change to the parser code itself, since the parser only stores POD-types in ValueVectorOf.
> Template ValueVectorOf does not call destructors for removing objects. A memory leak could result from this.
> ------------------------------------------------------------------------------------------------------------
>
> Key: XERCESC-1455
> URL: http://issues.apache.org/jira/browse/XERCESC-1455
> Project: Xerces-C++
> Type: Bug
> Components: Utilities
> Versions: 2.3.0
> Environment: Solaris
> Reporter: Alex Akula
> Assignee: David Bertoni
> Attachments: patch.txt
>
> When objects get removed from ValueVectorOf < object type> container no destructors are called for the objects. Amemory leak could result from this.
> This could be fixed by changing the code:
> template <class TElem> void ValueVectorOf<TElem>::
> removeElementAt(const unsigned int removeAt)
> {
> if (removeAt >= fCurCount)
> ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex);
> fElemList[removeAt] = 0; // akula -- this is the fix for classes in which assign operator is overloaded appropriate way.
> if (removeAt == fCurCount-1)
> {
> fCurCount--;
> return;
> }
> // Copy down every element above remove point
> for (unsigned int index = removeAt; index < fCurCount-1; index++)
> fElemList[index] = fElemList[index+1];
> // And bump down count
> fCurCount--;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org