First big project I'm using kotlin. The app seems ...
# android
First big project I'm using kotlin. The app seems to have a memory leak issue. I'm trying to understand what it is and I see a lot of "Class" allocations that never gets deallocated. I've looked into those and looks like every time I've a lambda an allocation like that happens. I'm not 100% sure the memory leak is there but so far I couldn't find any deallocation of those.
those are roughly 52 KB of allocation per Class object. And if every lambda generate those I can understand how my app goes slowly into out of memory. I couldn't find any context / activity leak.
This can't be right... or no one would use kotlin... anyone can help me understand what's going on?
would be nice to provide actual code that make memory leak
Its most likely the code your writting
and for your lambdas , also try to inline as much when needed, so you don’t end up with to much class overhead
If i knew where the leak was i would fix it don't you think? A lambda is a lambda. I can't inline it.
🤦‍♀️ 1
🤦 1
@Daniele I believe @rkeazor means that you should ensure that the methods you're passing the lambda into use the
👍 2
FYI I had no idea but apparently
by lazy
cause memory leak. I use this heavily and in my opinion this is an issue with kotlin.
and inline is not always possible