Are there any known memory gotchas that were intro...
# coroutines
g
Are there any known memory gotchas that were introduced with the 1.0 release and switch to structured concurrency (where launch and async are extensions on a coroutinescope?) The reason why I am asking is that we have had a service running for quite a long while with kotlin 1.2.61 and when we tried to bump it to kotlin 1.3 we are continously increasing in memory until we eventually crash
The only “big” functionality change we did was going over the code and we are now using coroutineScope {} instead of launching/asyncing from the GlobalScope
o
did you checked what objects are causing the OutOfMemory?
k
maybe you're using
GlobalScope.launch
and
GlobalScope.async
all over the place now to get it working and it turns out you're actually leaking those coroutines
g
now using coroutineScope {} instead of launching/asyncing from the GlobalScope
Hmm, but those are pretty different, how you could replace global coroutines with local
coroutineScope
function? coroutineScope suspends untill all child coroutines are finished, maybe you just have many leaked coroutines?
g
@kevinherron No we are not @gildor we don’t do much of fire and forget in out service. In all cases we do async but then await or launch and join so I understand what you are meaning with the different behavior but that shouldn’t be the case
g
I would first profile what is going on and where is leak, most probably there is a some leak caused by semantic changes during migration to structured concurrency
g
Cool, that will be our next step! Is VisualVM enough or are there any options that work better with kotlin? Thanks for the feedback @gildor and everybody else
g
VisualVM should be enough
👍 1