xtaci / smux

A Stream Multiplexing Library for golang with least memory usage(TDMA)
MIT License
1.27k stars 189 forks source link

Not cleaned timer caused exceesive memory usage #52

Closed joesis closed 5 years ago

joesis commented 5 years ago
ROUTINE ======================== github.com/xtaci/smux.(*Stream).Read in /Users/joesis/go/pkg/mod/github.com/xtaci/smux@v1.3.3/stream.go
         0   181.34MB (flat, cum) 72.23% of Total
         .          .     81:       }
         .          .     82:
         .          .     83:       var timer *time.Timer
         .          .     84:       var deadline <-chan time.Time
         .          .     85:       if d, ok := s.readDeadline.Load().(time.Time); ok && !d.IsZero() {
         .   181.34MB     86:           timer = time.NewTimer(time.Until(d))
         .          .     87:           deadline = timer.C
         .          .     88:       }
         .          .     89:
         .          .     90:       select {
         .          .     91:       case <-s.chReadEvent:
xtaci commented 5 years ago

could you PR to me?