More PC Precision Stuff

Denis Koroskin 2korden at gmail.com
Thu Oct 29 12:38:49 PDT 2009


On Thu, 29 Oct 2009 22:32:54 +0300, Lutger <lutger.blijdestijn at gmail.com>  
wrote:

> dsimcha wrote:
>
>> I've gotten underway hacking the GC to add precise heap scanning, but I
>> thought of one really annoying corner case that really would make things
>> an
>> order of magnitude more complicated if it were handled properly:   
>> Structs
>> and
>> classes that have large static arrays embedded.  For example:
>>
>> class Foo {
>>     Foo next;
>>     void*[4 * 1024 * 1024] hugeArray;
>> }
>>
>> The problem here is that scanning this precisely would require me to
>> either generate a megabyte bitmask that explicitly says "scan every
>> element of hugeArray" or to change my bitmask data structure from a flat
>> array to something nested and an order of magnitude more complex to
>> generate at compile time.
>>
>> Since this is such a rare case in practice, I'm tempted to just say that
>> any object with size above some arbitrary limit, say 1 kb, just gets
>> scanned
>> conservatively and be done with it.  For arrays, this would be a limit  
>> on
>> the size of the element, i.e. for a T[], it would be a limit on  
>> T.sizeof,
>> *not*
>> T.sizeof * length.  I'd like to get the community's input on this:  Is
>> this enough of a corner case that I have permission to cop out of  
>> solving
>> it properly for the sake of simplicity?
>
> Could you or anyone else solve this problem at a later stage? If that  
> would
> not be made more difficult then I would say cop out, at least for now.

Don't worry, it won't have any impact on the existing code.



More information about the Digitalmars-d mailing list