In Android and the c++ code, the data for the window is explicitly created and destroyed. In cases where 'close' isn't called explicitly, the finalize method will eventually free this memory. KN does not have a finalize. To achieve the same effect, we create a ByteArray in the Kotlin code, then give the pointer address of the start of that array, and when we want to clear that ByteArray, set it to null. It should free the memory immediately, but we should do some checking that this actually happens when expected.
In Android and the c++ code, the data for the window is explicitly created and destroyed. In cases where 'close' isn't called explicitly, the finalize method will eventually free this memory. KN does not have a finalize. To achieve the same effect, we create a ByteArray in the Kotlin code, then give the pointer address of the start of that array, and when we want to clear that ByteArray, set it to null. It should free the memory immediately, but we should do some checking that this actually happens when expected.