You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked there isn't already an issue for the bug I encountered.
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
Use the isAddress function to validate addresses in a loop (having more items than 8k) or with frequent calls in an iOS app (version 18+).
Platform: iOS 18+
Browser: Any
App: React-NextJs Web app
Link to Minimal Reproducible Example
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
@memoyil Does setting the strict parameter to false fix this?
If so, this would suggest that the underlying issue is from storing in the LruMap. Unfortunately, this class extends directly from the native Map() implementation so it would be hard to fix.
Another test would be if the issue comes from verifying the checksum. This could be tested by running a simplified address check against all addresses, for instance just allowing any 40 character string starting with 0x and containing only valid hexadecimal numbers. A simplified version for this test could be:
function isValidEthereumAddress(address: string): boolean { // Check if the address is a valid Ethereum address return /^0x[a-fA-F0-9]{40}$/.test(address); }
If this doesn't cause the memory leak there may be an issue from the checksum
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
Use the isAddress function to validate addresses in a loop (having more items than 8k) or with frequent calls in an iOS app (version 18+).
Platform: iOS 18+
Browser: Any
App: React-NextJs Web app
Link to Minimal Reproducible Example
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: