by ClassyJacket · 9y ago · 0 comments
I support anything that improves performance and efficiency. But the best of both worlds is always great. I'm wondering if it would be possible to implement reference counting (and maybe automatic reference counting) similar to Objective-C, and if so, would that simply be a matter of the particular language and WebAssembly transpiler you're using supporting it? And are there disadvantages to reference counting that make it a bad idea? I enjoyed using it doing earlier iPhone programming.
I thought it had a performance cost.
- the data isn't stored next to the count so you get two pointer indirection per access, or
- the data is stored next to the count, and the object gets cached-in when it gets collected.
Piggybacking on the thread because I haven't had much concrete experience with smart pointers: how does the "circular chain" problem seem to manifest? Is it
- "goes wrong quickly," usually picked up and fixed without too much trouble,
- "like any old memory leak" -- maybe a problem if processes run a long time, hard to track down, or
- devs are usually smart enough to see them coming, knowing to keep the "has a pointer to" relation a partial order (either by type or some other natural hierarchy.)
?