gofinance / ib

Pure Go interface to Interactive Brokers IB API
392 stars 122 forks source link

Fixing a potential memory leak problem #41

Open dimchansky opened 4 years ago

dimchansky commented 4 years ago

The underlying Timer is not recovered by the garbage collector until the timer fires. It's better to use time.NewTimer instead and call its Stop method when the timer is no longer needed to avoid potential memory leak issues.

It's hard to run into a memory leak issue in 5 seconds, but it will potentially reduce memory pressure when there are many short-lived subscribers.