Conversation
| } | ||
| import core.stdc.stdlib : free; | ||
| free(_refCounted._store); | ||
| () @trusted { free(_refCounted._store); }(); |
There was a problem hiding this comment.
I am not sure about this one. Is it safe to free memory from a pointer that we created and keep the reference too?
|
What we also need is a check to make sure Thanks, this looks pretty good! |
|
Since we never expose a direct pointer to the ref counted payload, I think Note, there is an existing issue for this: https://issues.dlang.org/show_bug.cgi?id=13983 |
|
Unless I'm missing something, we cannot currently make RefCounted |
Yes, and that's a good part of why Walter is currently working on adding a ref-counting solution to the language - because while you can make ref-counting solution with a library, you can't make an |
|
@klickverbot as long as you are in safe code, using the reference has to be while the ref-counted struct exists. You can't take the address of a ref in |
|
Nevermind, I just realized that you can return a ref, so that would be bad. Yeah, we have to wait on this. |
|
Why is Because of https://github.com/dlang/phobos/pull/4832/files |
follow-up to #4685