From: Jonathan S. <gel...@ge...> - 2004-03-25 14:02:41
|
On Wed, 2004-03-24 at 08:19, Bernhard Weininger wrote: > Hi ..., > > very nice tool, but is it possible that there is a memory leak? If I > run the example below the perl process will grow and grow ... > > Or is there something wrong with my code? The only thing I can think of is that you might want to move the lexical declaration of the $xslt variable within your for() loop as this may force the destruction of the objects. It might however be that we need to dispose() of some of the XML::DOM objects that are created within XML::XSLT. I'll check it out. /J\ > > Best regards, > > Bernhard > > > > ================================================================ > > use strict; > use XML::XSLT; > > my $xsl = "D:/transfer/XSL_BUG/HTML.xsl"; > my $xmlfile = "D:/transfer/XSL_BUG/attributes.xml"; > > my $xslurl = makeURL($xsl); > my $xmlurl = makeURL($xmlfile); > > my $i; > my $xslt; > for($i=0; $i<200; $i++) { > $xslt = XML::XSLT->new ($xslurl, warnings => 1); > > $xslt->transform ($xmlurl); > print $xslt->toString; > > > $xslt->dispose(); > } > > 0; > > > sub makeURL { > my $string = shift; > > ! ; if( $string =~ m|^file\://|i ) { return $string; } # if > already URL format > $string =~ s|\\|\/|g; # replace \\ > $string =~ s/\:/\|/o; # replace : > return "FILE://".$string; # add file:// > } > > > > ... and the winner is... WEB.DE FreeMail! - Deutschlands beste E-Mail > ist zum 39. Mal Testsieger (PC Praxis 03/04) > http://f.web.de/?mc=021191 |