{"action":"created","issue":{"url":"https://api.github.com/repos/yyzybb537/libgo/issues/21","repository_url":"https://api.github.com/repos/yyzybb537/libgo","labels_url":"https://api.github.com/repos/yyzybb537/libgo/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/yyzybb537/libgo/issues/21/comments","events_url":"https://api.github.com/repos/yyzybb537/libgo/issues/21/events","html_url":"https://github.com/yyzybb537/libgo/issues/21","id":181863182,"number":21,"title":"最近在写libgo的小例子， 发现空跑协程下， htop 显示内存会持续增长， 不知是什么原因, 而且总内存占用为6个G左右","user":{"login":"386898917","id":5134311,"avatar_url":"https://avatars.githubusercontent.com/u/5134311?v=3","gravatar_id":"","url":"https://api.github.com/users/386898917","html_url":"https://github.com/386898917","followers_url":"https://api.github.com/users/386898917/followers","following_url":"https://api.github.com/users/386898917/following{/other_user}","gists_url":"https://api.github.com/users/386898917/gists{/gist_id}","starred_url":"https://api.github.com/users/386898917/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/386898917/subscriptions","organizations_url":"https://api.github.com/users/386898917/orgs","repos_url":"https://api.github.com/users/386898917/repos","events_url":"https://api.github.com/users/386898917/events{/privacy}","received_events_url":"https://api.github.com/users/386898917/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-09T03:29:46Z","updated_at":"2016-10-09T03:49:13Z","closed_at":null,"body":"void go_test(){\r\n\t\r\n}\r\n\r\nint main(void) {\r\n\tint32_t count = 1000000;\r\n\twhile(count --> 0) {\r\n\t\t    go go_test;\r\n\t}\r\n\t\r\n\tstd::thread run([]{g_Scheduler.RunLoop();});\r\n\trun.join();\r\n}"},"comment":{"url":"https://api.github.com/repos/yyzybb537/libgo/issues/comments/252462924","html_url":"https://github.com/yyzybb537/libgo/issues/21#issuecomment-252462924","issue_url":"https://api.github.com/repos/yyzybb537/libgo/issues/21","id":252462924,"user":{"login":"yyzybb537","id":7001047,"avatar_url":"https://avatars.githubusercontent.com/u/7001047?v=3","gravatar_id":"","url":"https://api.github.com/users/yyzybb537","html_url":"https://github.com/yyzybb537","followers_url":"https://api.github.com/users/yyzybb537/followers","following_url":"https://api.github.com/users/yyzybb537/following{/other_user}","gists_url":"https://api.github.com/users/yyzybb537/gists{/gist_id}","starred_url":"https://api.github.com/users/yyzybb537/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yyzybb537/subscriptions","organizations_url":"https://api.github.com/users/yyzybb537/orgs","repos_url":"https://api.github.com/users/yyzybb537/repos","events_url":"https://api.github.com/users/yyzybb537/events{/privacy}","received_events_url":"https://api.github.com/users/yyzybb537/received_events","type":"User","site_admin":false},"created_at":"2016-10-09T03:49:13Z","updated_at":"2016-10-09T03:49:13Z","body":"100w协程占用内存4-6g是比较正常的现象, 如果希望使用更少的内存, 那就必须降低每个协程的栈内存使用量.\r\n使用默认的ucontext作为底层context编译libgo, 可以将协程栈的大小设置到1024bytes:\r\n  co_sched.GetOptions().stack_size = 1024;\r\n这样100w协程只需2GB内存, 不过这是很极限的做法, 并不推荐."}}
{"actor":{"display_login":"yyzybb537"}}