{"action":"created","issue":{"url":"https://api.github.com/repos/siddontang/go-mysql/issues/18","labels_url":"https://api.github.com/repos/siddontang/go-mysql/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/siddontang/go-mysql/issues/18/comments","events_url":"https://api.github.com/repos/siddontang/go-mysql/issues/18/events","html_url":"https://github.com/siddontang/go-mysql/pull/18","id":114571416,"number":18,"title":"set timeout to 1s to avoid memory leak","user":{"login":"windrainw","id":11924560,"avatar_url":"https://avatars.githubusercontent.com/u/11924560?v=3","gravatar_id":"","url":"https://api.github.com/users/windrainw","html_url":"https://github.com/windrainw","followers_url":"https://api.github.com/users/windrainw/followers","following_url":"https://api.github.com/users/windrainw/following{/other_user}","gists_url":"https://api.github.com/users/windrainw/gists{/gist_id}","starred_url":"https://api.github.com/users/windrainw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/windrainw/subscriptions","organizations_url":"https://api.github.com/users/windrainw/orgs","repos_url":"https://api.github.com/users/windrainw/repos","events_url":"https://api.github.com/users/windrainw/events{/privacy}","received_events_url":"https://api.github.com/users/windrainw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-02T10:53:45Z","updated_at":"2015-11-03T08:49:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/siddontang/go-mysql/pulls/18","html_url":"https://github.com/siddontang/go-mysql/pull/18","diff_url":"https://github.com/siddontang/go-mysql/pull/18.diff","patch_url":"https://github.com/siddontang/go-mysql/pull/18.patch"},"body":"I use replication, when use GetEvent to sync from master, the memory usage grow rapidly. the function \r\nGetEventTimeout use select to get Events from master and use time.After to set timeout, but the two chennel in different goroutine, when the sync channel return, the time.After channel continue to run, so the memory can't be released.\r\n\r\nset timeout to 1s， make sure not used too much memory, after 1s, all used memory by time.After will be\r\ncollect by garbage collector"},"comment":{"url":"https://api.github.com/repos/siddontang/go-mysql/issues/comments/153289722","html_url":"https://github.com/siddontang/go-mysql/pull/18#issuecomment-153289722","issue_url":"https://api.github.com/repos/siddontang/go-mysql/issues/18","id":153289722,"user":{"login":"siddontang","id":1080370,"avatar_url":"https://avatars.githubusercontent.com/u/1080370?v=3","gravatar_id":"","url":"https://api.github.com/users/siddontang","html_url":"https://github.com/siddontang","followers_url":"https://api.github.com/users/siddontang/followers","following_url":"https://api.github.com/users/siddontang/following{/other_user}","gists_url":"https://api.github.com/users/siddontang/gists{/gist_id}","starred_url":"https://api.github.com/users/siddontang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siddontang/subscriptions","organizations_url":"https://api.github.com/users/siddontang/orgs","repos_url":"https://api.github.com/users/siddontang/repos","events_url":"https://api.github.com/users/siddontang/events{/privacy}","received_events_url":"https://api.github.com/users/siddontang/received_events","type":"User","site_admin":false},"created_at":"2015-11-03T08:49:54Z","updated_at":"2015-11-03T08:49:54Z","body":"If the connect is timeout, an error will send to s.err. \r\nThe GetEvent won't timeout, and this function is only be used in go-mysqlbinlog now, if you want to use in your program, use GetEventTimeout instead, not GetEvent. \r\n\r\nBtw, why I use so large timeout time is that I just didn't want to write more codes before, only reused GetEventTimeout. :-)"}}