I'm having some trouble with StableRef. This progr...
# kotlin-native
t
I'm having some trouble with StableRef. This program prints "Hello world!" as expected, but that's followed by:
C:\BuildAgent\work\4d622a065c544371\runtime\src\main\cpp\Memory.cpp:1103: runtime assert: Memory leaks found
o
curiously, this is not a memory leak, but an excessive release: if you get rid of
ref2.dispose()
program will work as expected. Essentially, you need to call
dispose
only that many times, you called
StableRef.create
, converting C pointer to reference does not require disposing
t
Ah. I figured that since ref1 and ref2 were both StableRef instances and ref1 !== ref2, they were independent and should both be disposed. Thanks.