Commit 84f6caa
committed
fix: close idle conns for
to prevent memory leak
The HTTPClient2 instance was being created on
every `NewClient()` call but its idle
connections were never closed, leading to memory
accumulation.
While HTTPClient2 is only used as a fallback for
HTTP/2 protocol errors, it still allocates ~45MB
of per client instance (24MB for the client + 21MB
for HTTP/2 transport config).
This commit make sure that when `KillIdleConn`
is enabled, both `HTTPClient` and `HTTPClient2`
have their idle connections properly closed,
preventing the memory leak in scenarios where
multiple client instances are created.
Fixes #482.
Signed-off-by: Dwi Siswanto <[email protected]>HTTPClient2
1 parent a50c5a8 commit 84f6caa
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| |||
0 commit comments