{"action":"created","issue":{"url":"https://api.github.com/repos/SignalR/SignalR/issues/3205","labels_url":"https://api.github.com/repos/SignalR/SignalR/issues/3205/labels{/name}","comments_url":"https://api.github.com/repos/SignalR/SignalR/issues/3205/comments","events_url":"https://api.github.com/repos/SignalR/SignalR/issues/3205/events","html_url":"https://github.com/SignalR/SignalR/issues/3205","id":39888649,"number":3205,"title":"Memory build-up","user":{"login":"Katulus","id":1485893,"avatar_url":"https://avatars.githubusercontent.com/u/1485893?v=3","gravatar_id":"","url":"https://api.github.com/users/Katulus","html_url":"https://github.com/Katulus","followers_url":"https://api.github.com/users/Katulus/followers","following_url":"https://api.github.com/users/Katulus/following{/other_user}","gists_url":"https://api.github.com/users/Katulus/gists{/gist_id}","starred_url":"https://api.github.com/users/Katulus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Katulus/subscriptions","organizations_url":"https://api.github.com/users/Katulus/orgs","repos_url":"https://api.github.com/users/Katulus/repos","events_url":"https://api.github.com/users/Katulus/events{/privacy}","received_events_url":"https://api.github.com/users/Katulus/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-08-09T16:15:53Z","updated_at":"2015-12-15T13:27:40Z","closed_at":"2014-08-18T05:44:29Z","body":"Hello,\r\nI'm using SignalR server hosted in Windows service. I have hundreds of clients connected to this server. I noticed that when I start sending large messages from server to clients, memory grows (which is expected) but when all large messages are sent, memory does not drop.\r\n\r\nI took memory dump and found out that SignalR keeps thousands (in my case about 40,000) messages in memory in MessageStore<Message>.Fragment instances. I already set GlobalHost.Configuration.DefaultMessageBufferSize to 32 (which is minimal value that SignalR uses) but because of lots of clients I still have huge amount of messages in memory. \r\nI looked into code and found out that messages in store fragments are never removed unless they are overriden by new message. So if I send large chunks of data to clients which fills fragments and then just send one message now and then, memory is never released because fragments are holding data and they can't be GCed. \r\n\r\nIs this observation correct or am I missing something? Is there any way how to release old messages from memory other than overriding them with new messages? Could SignalR release message from store once it's sent?\r\n\r\nI'm having severe memory issues due to this fact. Even if I serialize big data transfers so that I send to only few clients at time, it eventually ends with OutOfMemoryException because old data are never removed.\r\n\r\nThanks for any advice.\r\nJiri"},"comment":{"url":"https://api.github.com/repos/SignalR/SignalR/issues/comments/164764579","html_url":"https://github.com/SignalR/SignalR/issues/3205#issuecomment-164764579","issue_url":"https://api.github.com/repos/SignalR/SignalR/issues/3205","id":164764579,"user":{"login":"danielmue","id":11872739,"avatar_url":"https://avatars.githubusercontent.com/u/11872739?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmue","html_url":"https://github.com/danielmue","followers_url":"https://api.github.com/users/danielmue/followers","following_url":"https://api.github.com/users/danielmue/following{/other_user}","gists_url":"https://api.github.com/users/danielmue/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmue/subscriptions","organizations_url":"https://api.github.com/users/danielmue/orgs","repos_url":"https://api.github.com/users/danielmue/repos","events_url":"https://api.github.com/users/danielmue/events{/privacy}","received_events_url":"https://api.github.com/users/danielmue/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T13:27:40Z","updated_at":"2015-12-15T13:27:40Z","body":"What is the reason for storing messages, that have been sent to all clients already?"}}