问题描述
我们的应用程序使用XslCompiledTransform.Transform功能。该行为是正常的,如果我们运行在32位模式,但是在64位模式下运行时,内存消耗只跳太高了(和最终必然引发内存异常)。同一code,同一台机器 - 一期工程,而其他没有....有没有人见过类似的问题,有一个解决办法
Our application uses the XslCompiledTransform.Transform function. The behavior is normal if we run it in 32 bit mode, however when running under 64 bit mode, the memory consumption just jumps way too high (and eventually throws out of memory exception). Same code, same machine - one works while the other does not ....Has anyone seen a similar issue and have a workaround?
谢谢
推荐答案
它实际上是一个 OutOfMemoryException异常
或 StackOverflowException
由于内存不足被分配到线程?我问,因为我碰到了这类问题在x64 Web服务器上运行IIS,为的分配256KB到一个线程的堆栈。我不得不做一些较大的变换(像DocBook到XSL-FO )在一个Thread堆栈以这种方式更多的空间:
Is it actually an OutOfMemoryException
or a StackOverflowException
due to insufficient memory being allocated to the thread? I ask because I ran into this type of problem on an x64 web server running IIS, as it only allocates 256kb to a Thread's stack by default. I had to do some of the larger transforms (like DocBook to XSL-FO) in a Thread with more room for the stack in this fashion:
var stackedThread = new Thread(RunXsltWithMoreMemory, 2 * 1024 * 1024);
var threadParameters = ThreadXsltParameters {
InputStream = inputStream; // Source XML
OutputStream = outputStream; // Resultant XML
};
stackedThread.Start(threadParameters);
stackedThread.Join();
这篇关于XslCompiledTransform.Transform 64位内存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!