Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KMP] Memory leak found in Base58.decode in iOS #4030

Open
10gic opened this issue Sep 18, 2024 · 0 comments
Open

[KMP] Memory leak found in Base58.decode in iOS #4030

10gic opened this issue Sep 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@10gic
Copy link
Contributor

10gic commented Sep 18, 2024

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:
Xnip2024-09-18_15-25-56

Additional context
This issue is common and not specific to Base58.decode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant