GC, the simple solution
Larry Evans
cppljevans at cos-internet.com
Thu Jun 8 17:50:58 PDT 2006
On 06/08/2006 06:04 PM, Sean Kelly wrote:
> Jeff Parsons wrote:
>
[snip]
>> performance in mind? Sure, there are workarounds, but I haven't seen
>> anything elegant yet that will let me use D for such applications
>> without making my memory management more complicated than it would
>> have been in C++. Is anything in the works?
>
>
> The spec doesn't contain any language forbidding such an approach, but I
> don't think the popular compilers will support it by default. Certainly
[snip]
> programming. That aside, there may be other approaches to garbage
> collection that would make everyone happy and that don't require
> additional code generation. If you know of one, please say so. My own
> knowledge of the topic is limited to what I've read in research papers.
You could define a policy pointer which could have as one policy, the
current Boehm collector. IOW, any ptr<BW> p(T) on the stack would be a
root pointer and each data structure would have a map of ptr<BW>
locations. Similarly, there could be ptr<Copy> or ptr<IncBw> or even
ptr<deterministic> and ptr<collected> instead of the
class [collected] SomeClass{...};
class [deterministic] OtherClass{...}
proposed by Adrei here:
http://tinyurl.com/o5zpm
This, of course, would require cooperation from the compiler, but
the same it would be true of:
class [collected] SomeClass{...};
it's just that some specializations, ptr<collected>, would be
predetermined and others, for example, user-defined ones,
would not.
More information about the Digitalmars-d
mailing list