Subject: Re: [xsl] trying again: automaticly image width and height From: Benjamin Franz <snowhare@xxxxxxxxxxx> Date: Sat, 12 May 2001 07:06:02 -0700 (PDT) |
On Sat, 12 May 2001, Janning Vygen wrote: > Am Samstag, 12. Mai 2001 00:41 schrieb Peter Flynn: > > > heres my question again: i tried some extension from lunatech to > > > insert width and height into the img tags of a html nod set. i cant > > > find the lunatech extensions in the internet again, so i cant ask > > > them why the i get an input stream error after about 400 images. > > > > Memory leaks? > > i am running linux That doesn't mean anything. Memory leaks are nearly always a problem with the _program_, not the operating system. The following trivial program would leak memory on *any* system, for example. Watch it with 'ps' or 'top' and you can see it steadily grow. #!/usr/bin/perl -w use strict; use Image::Size; local $/; my $data = {}; foreach (@ARGV) { next if (! -f $_); if (not open(DATA_FILE,$_)) { warn("Could not open $_: $!\n"); next; } $data->{$_} = <DATA_FILE>; close(DATA_FILE); print ("$_ : " . length($data->{$_}) . " bytes\n"); my $image = $data->{$_}; my ($width,$height,$type) = imgsize(\$image); next if (not defined $width); print (" height - $height, width - $width, type - $type\n"); sleep 1; } If you are using a Java based tool, odd are heavy that you are running in the default 64Mb heap - which goes boom fairly quickly if you have a leak. A work around (assuming you have enough real/virtual mem for the number of images you are going to be handling) is to invoke java with the -Xmx (see 'java -X' for info on it) flag and increase the heap space. Another work around is run 'non-persistently'. IOW if you are processing many documents and that is why you need 400+ images processed but no individual document has very many, reinvoke the *entire* program for each document processed. #!/usr/bin/perl -w use strict; foreach my $document (@ARGV) { # Call program here using # the 'system' call with whatever # the appropriate parameters are. system('java','program.jar',$document); } -- Benjamin Franz "Premature optimization is the root of all evil in programming." ---C.A.R. Hoare XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] trying again: automaticly, Janning Vygen | Thread | Re: [xsl] trying again: automaticly, Peter Flynn |
Re: [xsl] JAXP Transformer contract, Johannes Döbler | Date | Re: [xsl] trying again: automaticly, Peter Flynn |
Month |