Terry-Mao / goim

goim
https://goim.io/
MIT License
7.21k stars 1.78k forks source link

websocket 存在OOM的问题 #123

Closed ghost closed 8 years ago

ghost commented 8 years ago

websocket 在每次连接和每次异常断开(网页关闭掉) 或者发送消息的时候 会导致内存消耗并无释放。

liutaihua commented 8 years ago

贴个pprof看下? 我之前也有这个问题,是timer的closure导致的对象引用没有被释放, 已经pr在最新的分支里fix了。

ghost commented 8 years ago

4551.36MB 98.16% 98.16% 4551.36MB 98.16% goim/libs/bytes.(_Pool).grow 32.78MB 0.71% 98.86% 32.78MB 0.71% goim/libs/time.(_Timer).grow 32.47MB 0.7% 99.56% 32.47MB 0.7% main.NewBucket 4.06MB 0.088% 99.65% 36.84MB 0.79% goim/libs/time.(_Timer).init 0 0% 99.65% 4551.36MB 98.16% goim/libs/bytes.(_Pool).Init 0 0% 99.65% 4551.36MB 98.16% goim/libs/bytes.(_Pool).init 0 0% 99.65% 36.84MB 0.79% goim/libs/time.(_Timer).Init 0 0% 99.65% 4588.20MB 98.95% main.NewRound 0 0% 99.65% 4620.67MB 99.65% main.main 0 0% 99.65% 4622.17MB 99.68% runtime.goexit 0 0% 99.65% 4620.67MB 99.65% runtime.main

本身设备的内存使用时有限制的。 每次在top 执行后查看free的内存消耗 只减不增长。

Terry-Mao commented 8 years ago

bytes.Pool 永不释放的,保持最大内存工作;