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

isAddress function causes memory leak on iOS 18+ #2891

Closed
1 task done
memoyil opened this issue Oct 19, 2024 · 6 comments
Closed
1 task done

isAddress function causes memory leak on iOS 18+ #2891

memoyil opened this issue Oct 19, 2024 · 6 comments
Labels
needs reproduction Misc: Needs Reproduction

Comments

@memoyil
Copy link

memoyil commented Oct 19, 2024

Check existing issues

Viem Version

2.21.22

Current Behavior

The isAddress function in the viem library appears to cause a memory leak on devices running iOS 18 or later. When repeatedly calling isAddress in an iOS environment (version 18+), memory consumption steadily increases and is not released, leading to degraded app performance and eventually crashing after prolonged usage.

Expected Behavior

No response

Steps To Reproduce

Steps to Reproduce:

Use the isAddress function to validate addresses in a loop or with frequent calls in an iOS app (version 18+).

Link to Minimal Reproducible Example

No response

Anything else?

No response

@jxom
Copy link
Member

jxom commented Oct 19, 2024

I am unable to reproduce as the steps to reproduce are too vague. Is this a React Native environment, or a web app in a particular iOS browser?

Can you please open a new issue with a minimal reproducible example?

@jxom jxom added the needs reproduction Misc: Needs Reproduction label Oct 19, 2024
Copy link
Contributor

Hello @memoyil.

Please provide a minimal reproduction using StackBlitz, TypeScript Playground (for type issues), or a separate minimal GitHub repository.

Minimal reproductions are required as they save us a lot of time reproducing your config/environment and issue, and allow us to help you faster.

Once a minimal reproduction is added, a team member will confirm it works, then re-open the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2024
@jxom jxom reopened this Oct 19, 2024
@jxom jxom closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2024
@memoyil
Copy link
Author

memoyil commented Oct 22, 2024

@jxom I got a mail that you were able to reproduce it but cant find the comment now. Should i create an another ticket with more info ?

@jxom
Copy link
Member

jxom commented Oct 22, 2024

Sorry, yes, I thought I reproduced it, but it turns out the React Native Crypto lib I was using to generate random bytes for the addresses had a memory leak, and not isAddress itself. 😅

if you could provide a minimal repro, that would be great!

@memoyil
Copy link
Author

memoyil commented Oct 22, 2024

we have seen that issue, in ios 18+ (web app, nextjs) on this codestub. below 18 all is working fine

pancakeswap/pancake-frontend@e8744cf#diff-e2544e57f5f7176d8bf6a4c28edd3c7bfe26fd4a6724c6563a0a169c54fb8a22

data contains ~8000+ entries.

Any browser (i think because all of them using the same webkit provided by ios) getting unresponsive when this code stub is used, or if it is not, nextjs refreshes the page intermittently to clear the memory (which indicates there is memory leak)

When i change this to use own utils function (which is memoized by lodash that uses custom mapcache internally) we didnt see the issue anymore.

Copy link
Contributor

github-actions bot commented Nov 9, 2024

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs reproduction Misc: Needs Reproduction
Projects
None yet
Development

No branches or pull requests

2 participants