none
How to derive from the NameTable class to mitigate XmlReader memory leak? RRS feed

  • Question

  • Hi guys. I am trying to build a WCF application and it has memory leak problem. When I check using .NET memory profiler, memory leaks are caused by strings, rooted in XMLName -> NameTable, and ultimately rooted in System.ServiceModel classes.

    This article does say that using XMLReader can cause string memory leak. (just search for "memory leak" to find the paragraph). It says one of the mitigations to help the situation is:

    One mitigation for this is to derive from the NameTable class and enforce a maximum size quota. (There is no way to prevent the use of a NameTable, or to switch the NameTable when it is full)

    The same problem and mitigation is also mentioned here. My question is, how do I "derive from the NameTable class and enforce a maximum size quota", as the articles suggest?

    Tuesday, June 14, 2011 11:13 AM

Answers