https://kotlinlang.org logo
Title
i

itnoles

12/08/2017, 7:19 PM
Memory leak found is very hard to track down 😞
o

olonho

12/09/2017, 8:18 AM
Think Valgrind could help here
Compile your program on Linux and just run it with valgrind myprog.kexe
👍 1
i

itnoles

12/09/2017, 6:07 PM
Well, I uses Mac OS X.
it happens in NSURLSession with a delegate or callback.
s

Sam

12/09/2017, 8:16 PM
If you're using a block based wrapper around NSURLSession it can be easy to create a circular reference. The basic delegate callback mechanism of NSURLSession uses a weak reference and should not create a memory leak.
In your block wrapper if the block contains a reference to
this
inside of it, it will create a circular reference. You need to make it a weak reference.