[Mono-dev] Assembly.GetType() leaks with generic types

Juraj Skripsky js at hotfeet.ch
Tue Sep 4 13:50:54 EDT 2007


This is bug http://bugzilla.ximian.com/show_bug.cgi?id=82695. I'm
posting it here because it never made it to the list (mono-bugs).
Bugzilla doesn't like me :-(.


Test Case:
==========

using System;
using System.Reflection;

namespace TestApp {
  public class Test<T> {} 

  class Program {
    static void Main(string[] args) {
      Assembly assembly = typeof(Program).Assembly;

      int runs = int.Parse(args[0]);
      for(int i = 0; i < runs; i++) {
        assembly.GetType (
          "TestApp.Test`1[[System.Object, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089]]",
          true
        );
      }
    }
  }
}

Run "mono test.exe 2000000" and watch the mono process grow to over 300MB.
I'm using Mono from SVN.


- Juraj




More information about the Mono-devel-list mailing list