I have not followed the arc story too closely but I have a few questions about 
it. In particular I’d like to understand how it compares to the C++ memory 
model.

I skimmed the Lobster memory model document referenced by @Araq. In it they 
talk about “in-line, by-value structs”. Is this model used by arc for local, 
“simple” variables? That is, with arc, are Integers, floats, etc stored in the 
stack like they are in C++? What about strings and seqs? Are those immediately 
destroyed when the procedure in which they are declared exits? What about 
objects in general?

In another part of the Lobster memory management document they say:

Lobster combines its original (runtime) reference counting with a lifetime 
analysis algorithm, to get “compile time reference counting”.

Is this applicable to arc? If so, when do we get the compile time reference 
counting and when do we get the runtime reference counting?

Would it be correct to assume that arc would be equivalent to wrapping all 
variables of “non simple” types with std::shared_ptr in C++? Or perhaps with 
std::uniqur_ptr or a mix of both?

How deterministic is the memory management with arc? What about orc? Is there a 
garbage collector still needed and running in either case? Is there any runtime 
overhead due to the reference counting compared to what would be achieved with 
C++’s manual memory management?

Sorry if these questions have very obvious answers. I really think that some 
documentation comparing the arc (and the future orc?) memory model to the C++ 
model would be very useful that come from that kind of language.

Reply via email to