http://d.puremagic.com/issues/show_bug.cgi?id=7095



--- Comment #5 from David Simcha <dsim...@yahoo.com> 2011-12-11 10:38:41 PST ---
(In reply to comment #4)
> Isn't GC has a flag that says if something may contains pointer or not ?
> 
> Why this flag is set when allocation an array of long ?

It's not.  If a bit pattern in `arr` would point into GC memory if interpreted
as a pointer, then the pattern is ignored.  The GC has some level of precision
in that it knows whether a heap-allocated block contains any pointers or not. 
However, the issue is that pointers **from** somewhere else point **at** arr,
keeping it alive incorrectly.  

There are two sources for false pointers:

1.  The stack, where the GC has no knowledge whatsoever of what's a pointer and
what isn't.  I think this also applies to the static data segment.

2.  Heap allocated data structures that contain both pointer and non-pointer
data, e.g.:

struct Foo {
    void* ptr;
    size_t num;
}

If you allocate a Foo on the heap, the whole block will be marked as
potentially containing pointers.  The GC won't know what parts of it aren't
pointers.  `num` could have a bit pattern that would be a valid pointer and
will keep some objects alive unnecessarily.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to