-
Notifications
You must be signed in to change notification settings - Fork 21
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
References and memory leaks #55
Comments
We can, I suppose, limit refcounting to arrays only. |
Copying in @incrediblesound's https://github.com/HuoLanguage/huo/issues/52#issuecomment-232427437:
|
And my response:
|
Your thoughts, @incrediblesound? |
I'll try to get to this today, been a little busy of late :-/ |
That's fine, and I understand. I have been busy too (read: looking for work). |
So. I've been puttering around starting to deal with making sure that Huo doesn't leak memory like a sieve, and have hit upon a problem. Namely, arrays.
It's generally pretty clear when to free a value. However, since arrays in values are referenced by reference, instead of by value, one can have multiple references to an array. This means that we cannot just always free the array when freeing a value (of type array).
Normally, this is dealt with in one of two ways. Either through reference counting, or via garbage collection. However, given that you want performance, neither is particularly appealing.
On a very related note, how do you wish the following to work? Or rather, what do you want it to print?
Should it print [1]? Or []?
The text was updated successfully, but these errors were encountered: