XML::Twig - Memory usage problem
"howard chen" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I don't know if this is the place for my problem, if not, please point
me to the right direction...thanks.
Consider the following Perl codes...
#===============================
package TextXML;
....
my $t = XML::Twig->new(
twig_handlers => {
company => sub {
$self->company( @_[0], @_[1] );
@_[0]->purge;
},
}
);
$t->parsefile( "company.xml" );
$t->purge;
....
sub company {
my ( $self, $t, $elt ) = @_;
# Some string processing done here...
}
#===============================
My xml files was around 300MB, I found during runtime, the perl
process can grow up to 1GB.
I have put the 'purge' statement during xml node processing of node
"company", so I believe I am reading the xml file
chunk-by-chunk. So is my memory usage of 1GB normal?
The reason I ask is since my server has 8GB of memory, I am not sure
if since I have so many free memory, the Twig/Expat will
pre-allocate as much as possible for performance.
Any idea?
Thanks.
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs