wallet-core
wallet-core copied to clipboard
[KMP] Memory leak found in Base58.decode in iOS
Describe the bug
There is a memory leak in file kotlin/wallet-core-kotlin/src/iosMain/generated/com/trustwallet/core/Base58.kt (the iOS generated code for Base58.decode):
package com.trustwallet.core
actual object Base58 {
// ......
actual fun decode(string: String): ByteArray? =
TWBase58Decode(string.toTwString()).readTwBytes() // toTwString and readTwBytes leak memory!
// ......
}
Expected behavior The memory needs to be released.
Screenshots
Run Base58.decode 100000 times, it takes up to 200 MB of memory:
Additional context This issue is common and not specific to Base58.decode.