xmldoc = null;
CollectGarbage();

解决方案 »

  1.   

    CollectGarbage();??高,收藏。
      

  2.   

    强制垃圾收集是不是可能造成后续代码执行时不稳定?因为毕竟不是公开的函数。
    另外是不是可以从合理利用xmldom的方面谈谈解决之道?希望继续不吝赐教,谢谢!
      

  3.   

    ....请解释一下CollectGarbage()这个函数。以前没有看见过
      

  4.   

    it is a undocumented function, see explanation from Nancy Michell
    (http://msdn.microsoft.com/msdnmag/issues/01/05/web/web0105.asp)Q Can someone point me to some good documentation for garbage collection in JScript? I need to find out how JScript cleans up.A JScript uses a -and-sweep garbage collector with a variety of heuristics used to determine when to run garbage collection. The JScript garbage collector works like this:When the script engine is shut down, garbage is collected.When 256 variants, or more than 64KB of strings, or more than 4096 array slots have been allocated, the garbage collector sets a flag that says collect soon.Whenever a new statement is executed or the script debugger starts, that flag is checked, and if it is set, a collection is done.There is an undocumented JScript function called CollectGarbage that forces a garbage collection. This is for testing purposes only—do not ship code that calls this function. It is a poor programming practice to write code in JScript that depends on garbage collections being done at particular times. If you need predictable garbage collection, use a language that supports it (like Visual Basic® or VBScript). Note that all of this is the implementation detail of the engine and should not be relied upon because it may change in the future. Note also that the version of JScript supported by Microsoft® .NET will use the .NET Framework garbage collector, a multigenerational -and-sweep collector.
    And remember, if you want a deterministic-lifetime app, use a deterministic-lifetime language like C++, Visual Basic 6.0, or VBScript; not an indeterministic-lifetime language like JScript, Scheme, or Java. If you're writing a program that depends on being able to have a deterministic object lifetime, JScript is not the right tool for the job. Trying to make it a deterministic-lifetime language will just create headaches down the road.