Commit fb082a0
Fix
Some context to start: Cats Effects has been having memory leaks in CallbackStack since version 3.4.3.
See for example: typelevel/cats-effect#3935
I've been facing this memory leak in an application using fs2-kafka, and found that I'm not the only one (typelevel/cats-effect#3973).
Using a simple consumer > produce stream application, I monitored the size of the CallbackStack using the following command:
```
while sleep 1; do jcmd <pid> GC.class_histogram | grep 'cats.effect.CallbackStack$Node' ; done
```
I found that swapping the `F.race(shutdown, fetch)` for `fetch` stops the memory leak. This should not be an issue because the Stream is anyway interrupted on `.interruptWhen(F.race(shutdown, stopReqs.get).void.attempt)`, but I'm not 100% convinced of this.
Co-authored-by: Adrien Bestel <adrien.bestel@daimlertruck.com>CallbackStack.Node leak (#1318)1 parent ed3d15e commit fb082a0
1 file changed
+7
-11
lines changedLines changed: 7 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | 205 | | |
210 | | - | |
211 | | - | |
| 206 | + | |
| 207 | + | |
212 | 208 | | |
213 | | - | |
214 | | - | |
| 209 | + | |
| 210 | + | |
215 | 211 | | |
216 | | - | |
217 | | - | |
| 212 | + | |
| 213 | + | |
218 | 214 | | |
219 | 215 | | |
220 | 216 | | |
| |||
0 commit comments