Arantxa Otegi am Mittwoch, 14. Februar 2007 12:37:
> I have memory problems programming with perl: "out of memory!"
>
> I have to process a lot of xml files which are in different directories
> (more than 20000 files in 110 directories). The files are quite small
> (almost all of them are smaller than 100KB).
> Here is some code:
[snipped main script]
> package Expansion;
> use strict;
> use XML::DOM;
>
> $| = 1;
>
> sub fitx_expansioa{
> my $sarfitx;
> my $irteera_fitx;
> my %variantak;
> my $portzentaia;
> ($sarfitx,$irteera_fitx,$portzentaia,%variantak) = @_;
>
>
> my $dom_parser = new XML::DOM::Parser;
> my $dok = $dom_parser->parsefile($sarfitx);
>
> //XML process
> ...........
>
> my $irteeraXML = $dok->toString;
> $dok->dispose;
> open(I,">$irteera_fitx") or die "Ezin da ireki $irteera_fitx: $!";
> print I $irteeraXML;
> close I;
> }
Hello Arantxa Otegi
Maybe not of much help or directly related to your problem, but you may
consider using XML::LibXML instead of XML::DOM. It is much faster and
consumes less memory (but try Ken Foskeys tip first).
Dani
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/