xerces-p-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shawn W. Devlin" <sdev...@recognia.com>
Subject How to parse multiple documents?
Date Fri, 10 May 2002 14:39:46 GMT
Hello,

My program (using Xerces 1.5.2, Linux) waits for a signal then loads and 
parses an XML document. Over a prolonged run I found that my program 
used all available memory on the box. After stripping away all of the 
extra code, I was able to determine that it is the Xerces module that is 
not releasing the memory. I am sure that the problem lies with my code 
in that I am not calling some method to release the memory but I cannot 
find that method. I have tried  various combinations of defining and 
undefining variables and so far no luck.

If someone could point out my mistake it would be greatly appreciated.

Thanks,

Shawn


PS. The following is a program that exhibits the behaviour:


#!/usr/bin/perl -w
use strict;
use XML::Xerces;
use XML::Xerces::DOMParse;

my $Document = '';
my $key = '';
while ($key ne "q\n") {
    my $Parser = XML::Xerces::DOMParser->new();
    $Parser->setValidationScheme($XML::Xerces::DOMParser::Val_Auto);
    $Parser->setDoNamespaces(0);
    $Parser->setCreateEntityReferenceNodes(1);
    $Parser->setDoSchema(0);
    $Parser->setToCreateXMLDeclTypeNode(1);

    my $ErrorHandler = XML::Xerces::PerlErrorHandler->new();
    $Parser->setErrorHandler($ErrorHandler);

    my $is = 
XML::Xerces::LocalFileInputSource->new("/recog_logs/daemon.pat");
    $Parser->parse($is);
    $is = undef;

    $Document = $Parser->getDocument();
    $Document = undef;
    $Parser = undef;
    $ErrorHandler = undef;
    $key = <STDIN>;
}



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


Mime
View raw message