On Tue, 24 Feb 2015 14:55:14 -0500, Steven Schveighoffer wrote:

> Note, you need to GC.addRange all the elements if the type has
> references, or else you cannot have GC pointers in the array. For
> example, an array of class references could potentially result in those
> references being collected before the array is gone.

heh. yes, i hit this in my `iv.steam.PartialStream` implementation. those 
occasional crashes was nasty.

> Ironically, if those elements are references, but are reference counted
> references, then you wouldn't need to addRange. An interesting
> problem...

actually, it's safe to add GC roots and regions that contains no GC 
references. it's a little slowdown, as GC must scan that area, but 
nothing bad happens.

yet you are right, there should be some method to distinguish "gc-
agnostic" types. and compiler should be able to infer that...

Attachment: signature.asc
Description: PGP signature

Reply via email to