On 06/03/13 12:41, Paulo Pinto wrote: > Am 03.06.2013 18:00, schrieb Manu: >> Haha, wow. Indeed, isn't that well timed with respect to recent >> discussions! ;) >> Post-dconf, I gave it some serious thought and I'm kinda convincing >> myself more and more each day that it's the way to go. >> > > As I mentioned I prefer GC based solutions, but then again I live in the > JVM/.NET world, so I don't have the memory/timing pressure you have to > deal with. > > But when looking at systems programming languages that offer reference > counting as the main memory management, ATS, Parasail, Objective-C, and > now Rust, all of them share a common feature: > > - Compiler support to remove extra increment/decrement operations. > > I guess on D's case this support would also be required. > > -- > Paulo >
IIUC, a system programming language would use threading at least a fair amount. In that case, I'm not sure reference counting is appropriate, at least according to the following: .> However, I think you are also talking about RC in multi-threaded .> (not distributed) systems. Here, the cost of making RC thread-safe .> (both RC and pointer manipulations must be atomic) can be expensive .> if done naively. It's worth taking a moment to think about .> this. Consider a scenario with 3 objects, A, B and C, and two .> threads, T1 and T2. Suppose that T1 writes a reference to B into a .> slot in A and T2 writes a reference to C into the same slot. (You .> can say that such a program is broken but memory managers but cope .> with broken code). Both the reference count operations and the .> pointer updates must be synchronised so that the reference counts .> do reflect the final state of the reference held in A. This is .> prohibitively expensive if used for general memory management .> (i.e. rather than just for managing a few special objects). This is from a private email(which Jones said I could forward to c.l.c++.m, which, I assume means I can quote here also): .> Date: Fri, 15 Apr 2005 10:50:50 +0100 .> From: Richard Jones <r.e.jo...@kent.ac.uk> Of course maybe RC has improved since 2005. I'm no expert :( -regards, Larry