[Issue 3463] Integrate Precise Heap Scanning Into the GC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 27 21:19:09 PDT 2010


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



--- Comment #57 from Leandro Lucarella <llucax at gmail.com> 2010-07-27 21:19:01 PDT ---
I think there is a not-so-important bug in the DMD patch, the bits.length value
looks like it needs to be divided by size_t.sizeof (which is odd, since in the
patch it looks like it's already done in setSize()).

See this test program:

---
extern (C) int printf(char*, ...);

struct Test
{
        int x;
        void* p;
        char[15] s;
        Test* t;
        long l;
        union U {
                int* pi;
                int  i;
        }
        U u;
}

void main()
{
        Test* t = new Test;
        printf("sizeof = %zu\n", Test.sizeof);
        auto pm = typeid(Test).pointermap.bits;
        printf("PointerMap: ptr = %p, length = %zu, T words = %zu, scan bits =
%zx, ptr bits = %zx\n",
                        pm.ptr, pm.length, pm[0], pm[1], pm[2]);
}
---

The output is:

PointerMap: ptr = 0x805ab1c, length = 12, T words = 10, scan bits = 242, ptr
bits = 42

All looks nice except for the length value, which should be 3 instead of 12.

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


More information about the Digitalmars-d-bugs mailing list