Mukilesh Sethu
08/09/2022, 6:09 AMlaunch
) which polls data from a stream, and the reader is closed on job.invokeOnCompletion
. We use suspendCancellableCoroutine
to register a callback with the reader. 1 data point is polled at a time. We started seeing a potential memory leak with CancellableContinuationImpl/ChildContinuation
created as part of suspendCancellableCoroutine
. We expected only 1 active CancellableContinuationImpl/ChildContinuation
per job and that is the case but job holds reference to old ChildContinuation
from earlier which prevents it from getting GC'd (in the nodeList
)
My understanding is that it is detached from the job on successful invocation of resume
, which is what is expected from our service and even in the heap dump the state
of `ChildContinuation`denotes it. I am wondering if there is any other scenario where CancellableContinuationImpl/ChildContinuation
is not removed from the nodeList
? Or if there is a delay in removing it.