digitalmars.D - Proposal: traced pointers
- %u <u uuu.uuu> Jan 15 2007
In message 46503 of this forum Oskar Linde wrote: [ theoretical rambling omitted]As far as I can see, what I have to do to avoid memory leaks with a conservative GC, is one of the following: 1. move to a 64 bit architecture 2. manually handle all objects larger than a few hundred bytes [...] 3. hide all non pointer data from the GC
Oskar missed: 1a. tag all pointers with a magic number of arbitrary size This is indeed a modification of 1) because in this way an architecture with "pointer.sizeof + magicNumber.sizeof" is emulated, possibly including but not restricted to 64 bit architectures. It is not possible to implement such in a library and therefore it has to be implemented in the core language. In the spirit of Modula3 (which used "untraced" for pointers which are not GC'ed and GC'ed pointers being the default) it seems recommendable to introduce a "traced" feature into D. traced = none; // GC is switched off traced = marksweep; // current behaviour traced = marksweep(0); // using 0 byte taggig = current behaviour traced = marksweep(4); // using 4 byte tagging ...
Jan 15 2007