13 ms·
> The problem with refcounting is it can cause deallocation storms where a large object graph is suddenly released all at once because some root object was de-
by coliveira 12y ago
> The problem with refcounting is it can cause deallocation storms where a large object graph is suddenly released all at once because some root object was de-reffed
This only happens if you choose to organize the data this way. This is a big difference from GC, where the whole memory layout and GC algorithm is out of your control.
- Skinney 12y agoDepends on the language. Go, for instance, gives you a lot of freedom when it comes to memory layout, and allows you stack allocate objects to avoid GC.
- coliveira 12y agoIf you're using the stack, by definition you're not using GC, so this cannot be an argument in favor of GC.
- Skinney 12y agoIm not arguing in favor of GC. The argument was that a GC takes away memory control, but memory control is up to the language. Go doesn't restrict you to stack/heap allocation. You can create structs which embeds other structs. This simplifies the job the GC has to do, even if you don't allocate on the stack. You can do something similar with Struct types in C#.