Last update November 12, 2009

Garbage Collector



Difference (previous author) (Change, Edit, normal page display)

Changed: 3,6c3,7
# Do not use the array append ( ~= ) operator, or use the .length property to enlarge an array that has already been allocated. These rely on GC to free the old array if it has to be reallocated, since there may be aliasing to it somewhere else in the program.
# Do not use built-in associative arrays. The only way to free these is by GC.
# Most of Phobos and, I believe, Tango were designed with the assumption that garbage collection is present. Functions in these libraries may leak memory horribly if used w/o GC.
# Do not use D2 closures with GC disabled.
# Do not resize arrays, including concatenation.
# Do not use the associative arrays.
# Do not make use of closures.
# Do not use 'new' to create objects.
# Phobos and Tango generally assume a usable GC.

Changed: 9c10,16
SO: Turning off the D Garbage Collector
* SO: Turning off the D Garbage Collector
* D Kernel Development

There is also documentation on the garbage collector found in druntime:

* D1.x
* D2.x

D has an optional Garbage Collector. It is optional in that it can be disable or its function calls can be stubbed out. However many language features expect a garbage collector and should be avoid while it is disabled.

  1. Do not resize arrays, including concatenation.
  2. Do not use the associative arrays.
  3. Do not make use of closures.
  4. Do not use 'new' to create objects.
  5. Phobos and Tango generally assume a usable GC.
There is also documentation on the garbage collector found in druntime:

You may also want to look at the Garbage Collection Workgroup for progress on improving the GC performance.
FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: November 12, 2009 6:49 (diff))