-
-
Notifications
You must be signed in to change notification settings - Fork 846
Closed
Labels
pending-inputPending input or updatePending input or update
Description
It seems OnActivated (and possibly other callbacks?) leaks memory. Below a little test that uses more and more memory. If OnActivated is removed, problem is gone
public class FooTest
{
private int i;
[Test]
[Repeat(1000)]
public void Bar()
{
var builder = new ContainerBuilder();
Action<ContainerBuilder> registrationAction;
builder
.RegisterType<FakeService>()
.OnActivated(c =>
{
registrationAction = b =>
{
b.RegisterInstance(c.Instance);
};
});
var container = builder.Build();
container.Resolve<FakeService>();
container.Dispose();
i++;
if (i % 100 == 0)
Console.WriteLine((GC.GetTotalMemory(true) / 1024 / 1024) + "mb");
}
public class FakeService
{
private IEnumerable<int> _data;
public FakeService()
{
_data = Enumerable.Range(1, 100).ToArray();
}
}
}Metadata
Metadata
Assignees
Labels
pending-inputPending input or updatePending input or update