MassTransit/MassTransit — Issue #44: Memory leak issues
Author: jasondduncan
Created: 2011-10-18 17:43:30+00:00
State: open

We have a process that was created with the .8 version, and we are
having major memory leak issues. I tried to upgrade to 2.0, but the
differences in versions are breaking changes for us.

I have tried to do a test of the 2.0 version to see if it fixes the
problem, and it appears that every time messages are added/processed,
the memory just keep going up, and not releasing. Here is my simple
example. I have even tried using an instance instead of the
singleton.

[STAThread]
public static void Main(string[] args)
{
Bus.Initialize(sbc =>
{
sbc.UseMsmq();
sbc.VerifyMsmqConfiguration();
//sbc.UseMulticastSubscriptionClient();
sbc.ReceiveFrom("msmq://localhost/sendalert");
sbc.Subscribe(subs =>
{
subs.Handler(msg =>
{
Console.WriteLine("Alert");
msg = null;
});
});

});

_StartupSendAlert();
Console.Read();
}
private static void _StartupSendAlert()
{

var headers = new Headers();
headers.Items = new List

{
new Header { Key= "VendorNumber", Value =
"044822"},
new Header { Key= "HO", Value = "1"},
};
for (int i = 0; i < 10000; i++)
{
AddMessage(headers);
}
}

public static void AddMessage(Headers headers)
{
Bus.Instance.Publish(new SendAlertCommand { EmailBody =
"Test", Headers = headers });
}

I have the project zipped to help with the problem.