{"action":"created","issue":{"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/569","repository_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode","labels_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/569/labels{/name}","comments_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/569/comments","events_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/569/events","html_url":"https://github.com/stratisproject/StratisBitcoinFullNode/issues/569","id":264669096,"number":569,"title":"[NBitcoin] Handle and memory leaks","user":{"login":"Aprogiena","id":30052221,"avatar_url":"https://avatars0.githubusercontent.com/u/30052221?v=4","gravatar_id":"","url":"https://api.github.com/users/Aprogiena","html_url":"https://github.com/Aprogiena","followers_url":"https://api.github.com/users/Aprogiena/followers","following_url":"https://api.github.com/users/Aprogiena/following{/other_user}","gists_url":"https://api.github.com/users/Aprogiena/gists{/gist_id}","starred_url":"https://api.github.com/users/Aprogiena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aprogiena/subscriptions","organizations_url":"https://api.github.com/users/Aprogiena/orgs","repos_url":"https://api.github.com/users/Aprogiena/repos","events_url":"https://api.github.com/users/Aprogiena/events{/privacy}","received_events_url":"https://api.github.com/users/Aprogiena/received_events","type":"User","site_admin":false},"labels":[{"id":435911027,"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-10-11T17:21:15Z","updated_at":"2017-12-22T09:10:33Z","closed_at":"2017-12-22T09:06:58Z","author_association":"COLLABORATOR","body":"Diagnostic tools in MSVS revealed a lot of leaks in full node. Some of them are in full node.\r\n\r\nOne of the confirmed leaks seems to be in \r\n```\r\ninternal Node(NetworkAddress peer, Network network, NodeConnectionParameters parameters)\r\n```\r\n\r\nwhich creates \r\n```\r\n\t\t\t\tvar completed = new ManualResetEvent(false);\r\n\t\t\t\tvar args = new SocketAsyncEventArgs();\r\n```\r\nand dispose neither.\r\n\r\nAnother possibility is not using `SetBuffer(null, 0, 0)` on `SocketAsyncEventArgs`, which is necessary according to some sources (but does it still apply?).\r\n\r\nThen there are lots of `CancellationTokenSource` (and related `ManualResetEvent`) objects that just increase in memory. Also lots of `IPAddress` (and related `IPEndPoint`). \r\n\r\nAnd many others (`Socket`, `Timer`, ...)."},"comment":{"url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/comments/353555516","html_url":"https://github.com/stratisproject/StratisBitcoinFullNode/issues/569#issuecomment-353555516","issue_url":"https://api.github.com/repos/stratisproject/StratisBitcoinFullNode/issues/569","id":353555516,"user":{"login":"Aprogiena","id":30052221,"avatar_url":"https://avatars0.githubusercontent.com/u/30052221?v=4","gravatar_id":"","url":"https://api.github.com/users/Aprogiena","html_url":"https://github.com/Aprogiena","followers_url":"https://api.github.com/users/Aprogiena/followers","following_url":"https://api.github.com/users/Aprogiena/following{/other_user}","gists_url":"https://api.github.com/users/Aprogiena/gists{/gist_id}","starred_url":"https://api.github.com/users/Aprogiena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aprogiena/subscriptions","organizations_url":"https://api.github.com/users/Aprogiena/orgs","repos_url":"https://api.github.com/users/Aprogiena/repos","events_url":"https://api.github.com/users/Aprogiena/events{/privacy}","received_events_url":"https://api.github.com/users/Aprogiena/received_events","type":"User","site_admin":false},"created_at":"2017-12-22T09:10:33Z","updated_at":"2017-12-22T09:10:33Z","author_association":"COLLABORATOR","body":"There still are, but I'm working on it :-)"}}
{"actor":{"display_login":"Aprogiena"}}