I recently worked on a large-scale XML and XSLT application framework and one of the things we've found is that the garbage collector can be a problem when it comes to using XSLT in a large application with loads of requests.  You may end up having to use a thread-safe object that reuses things as much as possible.  It's a pain, I know, but it seems to help.  You should also DEFINATELY tweak your JVM settings to fiddle with the heap size.  If you don't, don't be surprised to start seeing OutOfMemory errors as your applications and transformations get larger.
 
BTW-  100 MBs of memory usage in a nice-sized XSLT application is really not that much :-)  If I could keep the memory usage under 100 MBs on my framework application under even moderate load, I'd be tickled! :-)  Under a heavy load, I was able to push memory usage up to about 1.5 GBs, sustained :-)

Thanks!

Jon Brisbin
=+=+=+=+=+=+=+=+=+=+=+=
www.jbrisbin.net
417.682.6157 (h/o)
417.850.1644 (cel)
 

-----Original Message-----
From: Damon Horrell [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 22, 2003 6:08 PM
To: '[EMAIL PROTECTED]'
Subject: Reusing Templates doesn't free memory

Hi,
 
I have written a little server program that uses a Templates object to avoid reparsing my XSLT each time I want to process a document.  I am finding that it chews up an awful lots of memory (like 100+ Mb) though which does not get released when the transformation is finished.  If I process the same document a few times the memory increases and then remains static after about the 3rd time, but it grows higher still if I process other documents.
 
I am not sure if this is because it is caching the source document or something. I have experimented with noth XPathContext.release and SourceTreeManager but to no effect.
 
I don't want anything other than the Templates object to be retained in memory after each transformation is run.
 
Does anybody know where the memory goes and how I can release it?
 
Has anyone else sucessfully written a similar application to efficiently process multiple source documents through the same transformation?
 
Thanks, Damon
 
BEGIN:VCARD
VERSION:2.1
N:Brisbin;Jon
FN:Jon Brisbin
NICKNAME:Jon
ORG:Jbrisbin.Net
TEL;WORK;VOICE:(417) 682-6157
TEL;HOME;VOICE:(417) 682-6157
TEL;CELL;VOICE:(417) 850-1644
ADR;WORK:;;394 S.E. 1st Lane;Lamar;MO;64759;United States of America
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:394 S.E. 1st Lane=0D=0ALamar, MO 64759=0D=0AUnited States of America
URL;WORK:http://www.jbrisbin.net
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20030520T160909Z
END:VCARD

Reply via email to