Code to show

bearophile bearophileHUGS at lycos.com
Wed Mar 5 16:11:55 PST 2008


Marius Muja:
> I'm using something very similar in my speed-critical code:

Thank you for showing. Your code is more refined (mine was an experimental version, not refined yet, little tested, dirty, etc) and it shows a couple ideas I too may adopt/copy.

But beside such secondary improvements, my main question was: if the element of those arrays  are object references, or pointers to GC structs, aren't such arrays going to produce GC problems when they aren't initialized yet? They can contain pointers that the GC may add to the roots... even if that memory block is essentially empty still. 

So I presume I must always disable the GC looking for pointers on them, and make the GC look for pointers only after I have filled the whole array (and it contains reference types, but I presume the GC is smart enough to stop looking at it if a block is filled with just non-reference types).

And note that such data structure is simple, it's just an 1D/2D array. When data structures are more complex I don't know anymore how the GC will manage them in such mixed manual/automatic situations... Programming in C is much simpler, because there's no a hidden subystem (the GC) that works in mysterious ways when your code is running.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list