To Reproduce
The following code can trigger a memory leak:
println("Test started")
val publicKeyHex = "044ba28b11af1561042b03b9d0f940446315af11358aa12d798050b3cf76265dab0f48b22ea1fc1f9560c969b966221f2821b746c4e56efaeaeec8689caf5843c9"
var i = 1
while (i <= 1_000_000) {
val publicKey = PublicKey(publicKeyHex.hexToByteArray(), PublicKeyType.SECP256k1Extended)
val anyAddress = AnyAddress(publicKey, Ethereum, Derivation.Default) // This leaks memory!
if (i % 10_000 == 0) {
println("Test case $i run")
}
i++
}
println("Test completed")
Expected behavior
No memory leak.
Screenshots
Memory Profiler Screenshot:
Additional context
The above test was conducted on Android. Based on the generated code in directory wallet-core-kotlin, this issue should also exist on iOS.
Hi @10gic, good catch! I'll investigate what can be the reason for the memory leak.
Could you please advise if you caught the memory leak while using other WC bindings? For example, PrivateKey or HDWallet?
Describe the bug I found a memory leak in AnyAddress within the Kotlin package of Wallet Core.
To Reproduce The following code can trigger a memory leak:
Expected behavior No memory leak.
Screenshots Memory Profiler Screenshot:
Additional context The above test was conducted on Android. Based on the generated code in directory wallet-core-kotlin, this issue should also exist on iOS.