Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [reference-counting]

The tag has no usage guidance.

11
votes
5answers
3k 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 ...
5
votes
4answers
352 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
3answers
344 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
2answers
116 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 ...
39
votes
3answers
31k 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 ...