Type Aware GC Questions

Craig Black cblack at ara.com
Mon Jan 29 11:42:03 PST 2007


Could it be done with an overloaded new somehow?

"Sean Kelly" <sean at f4.ca> wrote in message 
news:epli16$rvc$1 at digitaldaemon.com...
> Craig Black wrote:
>> "Walter Bright" <newshound at digitalmars.com> wrote in message 
>> news:ephqje$1eje$2 at digitaldaemon.com...
>>> Craig Black wrote:
>>>> I was wondering, just how smart is the compiler now?  If I define a 
>>>> class
>>>> that doesn't have any pointers, then will the compiler know that it 
>>>> doesn't
>>>> have pointers?
>>> Yes.
>>>
>>>> If I only have one pointer in my class, will the GC only
>>>> scan that location?
>>> No, it'll scan the whole class. All it has is a bit that says "might 
>>> have pointers" or "has no pointers".
>>
>> If I have such a class, is there something I can do to inform the GC not 
>> to scan a certain portiion of memory?
>
> Phobos:
>
>     import std.gc;
>
>     MyClass c = new MyClass;
>     hasNoPointers( c );
>
> Tango:
>
>     import Tango.core.Memory;
>
>     MyClass c = new MyClass;
>     gc.setAttr( c, GC.BlkAttr.NO_SCAN );
>
> But this still only works for the entire memory block, not a subrange.
>
>
> Sean 





More information about the Digitalmars-d mailing list