3 ms·
> GC enable sharing and how the only reasonable alternative when implementing a similar system in a non-GC language is a lot of gratuitous copying to solve owne
by masklinn 11y ago
> GC enable sharing and how the only reasonable alternative when implementing a similar system in a non-GC language is a lot of gratuitous copying to solve ownership issues
The solution to unclear or shared ownership is generally reference counting. There's a reason why shared_ptr is called that.
- pjmlp 11y agoWith the usual set of locks, cache contention and pauses on cascade deletions of deep datastructures it brings.
- masklinn 11y agoYou don't need locks to RC immutable structures, just atomics (and not even that if the system is single-threaded)
- pascal_cuoq 11y agoReference counting is a garbage-collection system like the others (and if you are going to use a garbage-collection system, you can for many usecases do better than reference counting).
- masklinn 11y ago> Reference counting is a garbage-collection system like the others Reference counting is a form of automated memory management which can easily be integrated and used in a manually-managed system, and can be used for a specific subset of the in-memory structures (again see shared_ptr). Not so for more complex garbage collection systems which tend to interact badly with manual or ownership-based memory management. Putting the lie to your assertion that the only way to implement sharing in a non-GC language is "gratuitous copying".
- pascal_cuoq 11y agoYes, it's a shame that you were not a reviewer, mid-2009, of my article published in September 2009.