[D-runtime] Precise garbage collection

Steven Schveighoffer schveiguy at yahoo.com
Fri Jun 21 13:22:38 PDT 2013


I agree that we should put precise garbage collection into the GC.  At least as an option (the GC is swappable I think).

On Jun 21, 2013, at 2:36 PM, Rainer Schuetze <r.sagitario at gmx.de> wrote:

> There are a number of issues that should be discussed:
> 
> d2. Both dynamic and associative arrays currently allocate memory chunks and use them in a "non-standard" way that cannot be described by a simple TypeInfo. For example, dynamic arrays keep track of the allocated size of the array by placing it at the very end of allocations < 4k, but at the beginning for allocations >= 4k, moving the data to an offset of 16 in the latter case. Associative arrays combine hash-list-node, key and value into a single allocation, sometimes even with the value type unavailable.

The dynamic array "allocated size" location and size is predictable, and can be determined whether it exists based on the APPENDABLE bit.  You should be able to correctly ignore it during a collection.  Or am I misunderstanding the reason you posted that?

-Steve


More information about the D-runtime mailing list