Difference between revisions of "Versus the garbage collector"
(more links) |
(Category:Garbage Collection) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 47: | Line 47: | ||
* Cannot find original thread | * Cannot find original thread | ||
− | == | + | == External links == |
− | * http://forum.dlang.org/post/bsqqfmhgzntryyaqrtky@forum.dlang.org | + | * [http://forum.dlang.org/post/bsqqfmhgzntryyaqrtky@forum.dlang.org The "no gc" crowd] |
− | * http://forum.dlang.org/post/l34lei$255v$1@digitalmars.com | + | * [http://forum.dlang.org/post/l34lei$255v$1@digitalmars.com draft proposal for ref counting in D] |
− | * | + | * [ftp://ftp.sgi.com/other/gc/issues.html (About the Boehm GC, but generally interesting)] |
− | * http://www.hpl.hp.com/ | + | * [http://www.hpl.hp.com/techreports/2003/HPL-2003-215.html The Space Cost of Lazy Reference Counting (technical report)] |
− | * http://www.quora.com/Computer-Programming/How-do-reference-counting-and-garbage-collection-compare/answer/Jon-Harrop-1?srid=3Gvg&share=1 Jon Harrop's answer to: | + | * [http://www.quora.com/Computer-Programming/How-do-reference-counting-and-garbage-collection-compare/answer/Jon-Harrop-1?srid=3Gvg&share=1 Jon Harrop's answer to: Computer Programming: How do reference counting and garbage collection compare?] |
− | Computer Programming: How do reference counting and garbage collection compare? | + | |
+ | [[Category:Garbage Collection]] |
Latest revision as of 07:08, 26 January 2019
The big discussion about the garbage collector repeatedly comes up. This page tries to provide a summary.
Contents
Why GC is bad
- Unpredictable pauses which stop the world
- Current implementation sucks
Why GC is good
- Safe by default and non-leaking memory management
- Acceptable performance for many cases
- Supports immutable types
Common Ground
- We want something, which is safe by default
Proposals
Compiler-supported Reference Counting
Compiler generates reference counting for all references
- Pro: More predictable
- Pro: No manual rewriting necessary
- Contra: Cycles would leak
- Contra: Overhead due to inc/dec operations
- Open question: Does ARC guarantee memory safety?
Library Reference Counting
Use std.typecons.RefCounted
- Pro: Garbage collector still provides safety
- Contra: Lots of manual work
- Contra: Overhead due to inc/dec operations
DIP18: nogc attribute
- Pro: Compile-time checked
- Pro: Selective usage
- Contra: Attribute creep
Implement Certain Interface
- Cannot find original thread