Dynamo.IoC icon indicating copy to clipboard operation
Dynamo.IoC copied to clipboard

Potential memory leak

Open danielpalme opened this issue 10 years ago • 0 comments

If container is initialized with CompileMode.Dynamic the used memory is continuously growing. With CompileMode.Delegate this does not happen.

You should be able to reproduce with this sample code:

class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            var container = new IocContainer(defaultCompileMode: CompileMode.Dynamic);
            container.Register<ITransient, Transient>();
            container.Compile();
            container.Dispose();
        }
    }
}

public interface ITransient
{
    void DoSomething();
}

public class Transient : ITransient
{
    public void DoSomething()
    {
        Console.WriteLine("Hello");
    }
}

danielpalme avatar Jan 29 '15 14:01 danielpalme