Re: Resource Leak from XslCompiledTransform

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello,

I set up a smaller environment and tested with two simple XSLT files.
One had a small script inside and the other one did't.

The consumption of memory goes up as you said and I observed that
the Bytes of the Loader Heap of the process was increasing everytime
I did trasformations with the XSLT file that has a script.

The memory leaks in XSLT with scripts are not yet fixed in .net 2.0.
And actually this is my real headache. I don't wanna compel others to
use extension objects instead of scripts, yet the loaded script can not be
unloaded as you have said. Perhaps a separated AppDomain is the
way to go, if we are to have the application to survive a little longer and
keep its memory consumption at a reasonable level.

Thanks for all that has replied.


--
Best Regards,
W. Jordan



"Oleg Tkachenko [MVP]" <some@xxxxxxxx> wrote in message
news:Oq9997aeGHA.1272@xxxxxxxxxxxxxxxxxxxxxxx
I don't think there is any difference between obsolete XslTransform and
XslCompiledTransform with regards to scripts. XslTransform leaks the same
way, see http://support.microsoft.com/?id=316775. And this has nothing to
do with XslCompiledTransform, you just cannot unload assembly in .NET.

Use extension objects instead of scripts.

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com

W. Jordan wrote:
Hello,

Thanks for pointing out that.

Actually I really suspect that whether the XslCompiledTransform should
replace the old XslTransform class, which looks lightweight and easier to
manipulate. If we cache the XslTransform objects into the memory,
just as we (they did in the discussion in the forums) might do in our
practices, once the XslTransform is loaded, it is there. And there won't
be any trash files in the temp folder, nor will the memory consumption
increase as we load (reload) more and more stylesheets--yes, in my
ASP.net application, we have the application automatically reload the xsl
files if they are modified during the runtime. The auto-reload, but
non-memory-
leak feature is quite important for ASP.net applications which are
expected
to run long. If we use the XslCompiledTransform class, this won't be a
viable approach since every time we reload the stylesheet, the memory
consumption increases and after several scores of reloading, the ASP.net
application will hog a monstrous amount of memory, which is obviously
neither desirable nor necessary.

So, I personally will turn back and stick to the lagacy one, XslTransform
class, for not having to clean up temp files, nor worrying about memory
consumptions.


.



Relevant Pages

  • Re: Load Python Scripts from Memory
    ... > script/module from memory. ... > am building for scripts to be downloaded from a web site and run ... > (these can be pre-compiled scripts). ... stuff in memory from a "resource file", ...
    (comp.lang.python)
  • Re: I am pretty sure this isnt a FP problem but maybe someone can
    ... You just may want to check the scripts as they ... I would have them track your memory usage along ... of an hacker attack and this is the latest response I ... depth knowledge of all the scripts used on your website. ...
    (microsoft.public.frontpage.client)
  • Re: matlab speed issues
    ... windows, then creating and reusing one figure window would probably help. ... Although I've used the same function twice, the same memory space can't be used - the memory gets repeatedly fragmented. ... Although I'm told that functions are faster than scripts, they also seem to create other problems wrt fragmentation. ...
    (comp.soft-sys.matlab)
  • Re: mod_perl 1.99 apache 2.0.48
    ... > I did not modify my perl scripts in order to use mod_perl, ... references leaks memory. ... All sorts of things you do in Perl that should not leak memory do anyway. ...
    (comp.lang.perl.misc)