Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when sending from the server. #326

Open
wade-dp opened this issue May 11, 2022 · 1 comment
Open

Memory leak when sending from the server. #326

wade-dp opened this issue May 11, 2022 · 1 comment

Comments

@wade-dp
Copy link

wade-dp commented May 11, 2022

We have a web socket server that is sending live data to connected clients.
We are leaking large amounts of memory when I add the calls to IWebSocketConnection.Send

This could be due to how we are using the socket, but I wanted to know if there is a known issue with sending large amounts of data from the server?

public void Start(CancellationToken stoppingToken)
{
	Task.Run(async () =>
	{
		while (!stoppingToken.IsCancellationRequested)
		{
			// read from each queue and send
			if (_binaryMessageQueue.TryDequeue(out var binaryMessage))
			{
				await Socket.Send(binaryMessage).ConfigureAwait(false);
			}
			if (_textMessageQueue.TryDequeue(out var textMessage))
			{
				await Socket.Send(textMessage).ConfigureAwait(false);
			}

			if (_binaryMessageQueue.IsEmpty && _textMessageQueue.IsEmpty)
			{
				await Task.Delay(10, stoppingToken).ConfigureAwait(false);
			}
		}
	}, stoppingToken);
}
@NotoriousRebel
Copy link

@wade-dp Any updates to this? Plan to use this for a project but memory leaks overtime is not ideal, PerfMon should help figure out where the memory leak is if ones exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants