Questions tagged [reference-counting]
The reference-counting tag has no usage guidance.
9
questions
0
votes
2
answers
546
views
What problem does Rust's "atomic reference count" actually solve?
The Rust programming language offers a Arc atomic reference counting generic type for use in multi-threading environment, since Rc is optimized for performance in single-threaded applications, and ...
3
votes
3
answers
477
views
What is the best way to retain a local object which is performing an asynchronous task?
My problem is the following: inside a method I'm creating an object like this:
MyObject* myObject = [MyObject new];
Then I want it to perform an asynchronous task like this:
[myObject ...
1
vote
2
answers
796
views
How is it that reference counting is faster on Apple silicon Intel translation than on Intel?
I can't find the exact tweet, but it was stated by Apple engineers that the retain and release operations are faster on Intel x86 translation than on standard Intel x86.
0
votes
2
answers
204
views
What's the canonical way to do compaction on a refcounted heap?
The only way I know of is to copy the whole heap by allocating copies of all objects on a new heap and dropping the old one, like couchbase db does for example. Presumably you could also do the same ...
11
votes
5
answers
5k
views
A reference counting pattern for memory managed languages?
Java and .NET have wonderful garbage collectors that manage memory for you, and convenient patterns for quickly releasing external objects (Closeable, IDisposable), but only if they are owned by a ...
6
votes
4
answers
757
views
Strategy for avoiding defensive copies while keeping correct encapsulation
I want to keep a dependency decoupled, but at the same time, once it's passed to the constructor, I want to allow changes only through Whatever (in the following example) because changing the ...
-1
votes
3
answers
389
views
I just used a goto statement. Is this OK? [closed]
I just wrote this code that uses a goto statement.
if (PyMethod_Check(attrib_value)) {
PyObject *im_self = PyObject_GetAttrString(attrib_value, "im_self");
if (im_self == Py_None) {
...
3
votes
2
answers
131
views
COM - with great power comes great responsibility, but at what cost? (looking for advice on coding practices when working with COM)
What is best (or commonly accepted) practice for where to declare COM object variables (scope) and how to handle cleaning them up when using structured error handling?
I just spend a whole load of ...
77
votes
3
answers
56k
views
How does garbage collection compare to reference counting? [duplicate]
I starting working through an online course on iOS development in the new language from Apple, Swift. The instructor made a point that raised this question in my mind. He said something to the ...