Commit d9cac6f
committed
fix: properly close broadcast channel to prevent memory leak
With a large number of requesting clients, the software keeps open an evenly large number of client structs and broadcastChannels filled with certificates.
This is due to the broadcastHandler goroutine waiting for new elements to arrive in the channel. Since that does not happen, the client struct will not be freed and thus heap memory keeps piling up.
In my case the tool used up ~3-4 GB of memory after 228 days of runtime with a single client that connected and disconnected frequently.1 parent 9b866d5 commit d9cac6f
1 file changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
0 commit comments