-
Notifications
You must be signed in to change notification settings - Fork 127
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
Memory leak: calling free() on an object does not free all referenced objects. #578
Comments
I narrowed it down to:
Even keeping the return values in an array to later free them, memory increases. |
Hi @MarcelKlammer! In the CSL, if you use an object as an argument, the CSL does not capture the object reference but copies the object's value for internal usage. We do that because we can't control a lifetime of external objects inside our rust codebase.
In your example, when you put bigNum as a CSL's function argument, the function just uses a copy of that bigNum value.
Till we don't add auto object freeing, you can use that workaround #542 (comment) |
Ok, just to be 100% clear, all returned values of all functions are copies / new objects. And all parameters provided to CSL functions will be copied instead of referenced? |
Unfortunately yes |
Thanks for the clarification. |
Freeing up memory does not seem to work for referenced objects. The memory is slowing increasing, eg. on SundaeSwap, which is calling getUtxos() frequently, keeping a wallet connected results in the wasm memory slowly increasing to 2GB and then crashing.
The text was updated successfully, but these errors were encountered: