[Mono-list] How many strings do I have?

Jonathan Pryor jonpryor@vt.edu
Sat, 09 Oct 2004 11:43:29 -0400

On Fri, 2004-10-08 at 04:39, Jeroen Frijters wrote:
> Jonathan Gilbert wrote:
> > Once a string is in the pool, it can NEVER be removed
> > (until the AppDomain is disposed).
> In Java the string intern pool uses weak references. I don't know about
> .NET, but I'd hope it does the same.

I believe it doesn't.  From [1]:

        Interning happens two ways in the CLR.
        2) It happens automatically, when you load an assembly.  All the
        string literals in the assembly are intern’ed.  This is
        expensive and – in retrospect – may have been a mistake.  In the
        future we might consider allowing individual assemblies to
        opt-in or opt-out....

 - Jon

[1] http://blogs.msdn.com/cbrumme/archive/2003/04/22/51371.aspx