You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by "Shawn W. Devlin" <sd...@recognia.com> on 2002/05/10 16:39:46 UTC

How to parse multiple documents?

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


Re: How to parse multiple documents?

Posted by "Shawn W. Devlin" <sd...@recognia.com>.
Jason E. Stewart wrote:

>Hi Shawn,
>
>Thanks for using xerces.
>
>There have been a huge number of memory fixes since 1.5.2, please
>upgrade to the latest version, 1.7.0-1, and let me know if you still
>see the problem.
>

I have upgraded to 1.7 and I am still experiencing the problem.


-- 
This communication is intended to be received by the individual or
entity to whom or to which it is addressed and it contains information
that is privileged, confidential and subject to copyright of 
Recognia Inc. Any unauthorized use, copying, review or
disclosure is prohibited. If received in error, please contact me by
phone at 613-623-6159 or by email at mailto:sdevlin@recognia.com.




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


Re: How to parse multiple documents?

Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Shawn W. Devlin" <sd...@recognia.com> writes:

> 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. 

Hi Shawn,

Thanks for using xerces.

There have been a huge number of memory fixes since 1.5.2, please
upgrade to the latest version, 1.7.0-1, and let me know if you still
see the problem.

Thanks,
jas.

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


Re: How to parse multiple documents?

Posted by "Shawn W. Devlin" <sd...@recognia.com>.
Further investigation reveals that everything works fine as long as I 
don't call $Parser->getDocument();

Once I get a document the memory does not seem to be released.

Shawn W. Devlin wrote:

> 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
>
>
>


-- 
This communication is intended to be received by the individual or
entity to whom or to which it is addressed and it contains information
that is privileged, confidential and subject to copyright of 
Recognia Inc. Any unauthorized use, copying, review or
disclosure is prohibited. If received in error, please contact me by
phone at 613-623-6159 or by email at mailto:sdevlin@recognia.com.




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