Return-Path: Delivered-To: apmail-xml-xerces-c-dev-archive@www.apache.org Received: (qmail 23214 invoked from network); 5 Mar 2004 15:51:46 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Mar 2004 15:51:46 -0000 Received: (qmail 39582 invoked by uid 500); 5 Mar 2004 15:51:37 -0000 Delivered-To: apmail-xml-xerces-c-dev-archive@xml.apache.org Received: (qmail 39562 invoked by uid 500); 5 Mar 2004 15:51:37 -0000 Mailing-List: contact xerces-c-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: xerces-c-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list xerces-c-dev@xml.apache.org Received: (qmail 39510 invoked from network); 5 Mar 2004 15:51:37 -0000 Received: from unknown (HELO pscgate.progress.com) (192.77.186.1) by daedalus.apache.org with SMTP; 5 Mar 2004 15:51:37 -0000 Received: from elvirus.progress.com (elvirus [192.77.186.100]) by pscgate.progress.com (8.12.11/8.12.11/PSC-5.11) with ESMTP id i25FpcEE011319 for ; Fri, 5 Mar 2004 10:51:39 -0500 (EST) Received: from progress.com (localhost [127.0.0.1]) by elvirus.progress.com (8.10.2/8.10.2/PSC-4.01) with ESMTP id i25FpgE18741 for ; Fri, 5 Mar 2004 10:51:42 -0500 (EST) X-Authentication-Warning: elvirus.progress.com: iscan owned process doing -bs Received: from naserv.bedford.progress.com (naserv [172.16.5.174]) by progress.com (8.11.6/8.11.6) with ESMTP id i25Fpcn03882 for ; Fri, 5 Mar 2004 10:51:38 -0500 (EST) Received: from AlbertoMassari.progress.com by naserv.bedford.progress.com (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0HU400D011DV0O@naserv.bedford.progress.com> for xerces-c-dev@xml.apache.org; Fri, 05 Mar 2004 10:51:37 -0500 (EST) Date: Fri, 05 Mar 2004 16:51:29 +0100 From: Alberto Massari Subject: Re: Memory Trouble in DOMNode::getTextContent In-reply-to: <5.2.1.1.1.20040305162850.044e6108@mail.wsl.ch> X-Sender: amassari@namail.bedford.progress.com To: xerces-c-dev@xml.apache.org Message-id: <6.0.3.0.2.20040305164742.032c7ec0@namail.bedford.progress.com> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 6.0.3.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <5.2.1.1.1.20040305162850.044e6108@mail.wsl.ch> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N At 16.41 05/03/2004 +0100, Patrick Wicki wrote: >Hello, >I still have memory trouble using DOMNode::getTextContent with XERCES Ver. >2.3.0! >The following loop I created runs about 1400 times on my machine, and >shortly after that it crashes! Does anybody see what causes the leak!? It's not a leak; getTextContent() will allocate the returned buffer from the memory pool held by the DOMDocument. That memory will be released when you release the DOMDocument itself, but if you keep invoking it, your app will crash because of an uncaught "out of memory" exception. The only suggestion I can give you is to avoid using getTextContent when you know that the element only contains a single text node, and use getNodeValue() on that child node. Alberto >(I always ask for the same tag ("aufopn_1") to make it as easy as possible!) > >Regards and thanks for the hint before >Patrick > > >void get_sql_stat_from_xml_test() >{ > DOMNodeList* sql_statements; > > //Allocate XMLCh for Tag > static XMLCh* pOutputEncoding[1]; > > pOutputEncoding[0] = XMLString::transcode("aufopn_1"); > > //1486 times ok, 1487 time it crashes! > for(int i=0; i<1486; i++){ > sql_statements = > get_xml_document()->getElementsByTagName(pOutputEncoding[0]); > char* > pStr=XMLString::transcode(sql_statements->item(0)->getTextContent()); > XMLString::release(&pStr); > > } > > //Release > XMLString::release(&pOutputEncoding[0]); >} > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org >For additional commands, e-mail: xerces-c-dev-help@xml.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org For additional commands, e-mail: xerces-c-dev-help@xml.apache.org