[Gc] Re: Re[4]: : Program broken

Hugn up2dream at gmail.com
Fri Sep 25 23:07:59 PDT 2009


Ivan Maidanski <ivmai at ...> writes:

> 
> Hi!
> 
> Hugn <up2dream at ...> wrote:
> > ...
> > My platform is wince 5(Pocket PC). I didn't using GC_clear_roots,
> > GC_remove_roots and GC_exclude_static_roots. In my WinMain, I called 
GC_dump.
> > But it print no static root. Is this right?
> 
> No. Something is wrong. Do you call GC_INIT() before GC_dump()? (I assume you 
are using the latest CVS
I called GC_INIT() before GC_dump().

> snapshot. And compiled with -DGC_ASSERTIONS.)
> If yes then compile with -DDEBUG_VIRTUALQUERY added and debug 
GC_register_dynamic_libraries(): watch
> whether it's called and whether it calls GC_cond_add_roots() (if not, tell me 
the reason).
GC_register_dynamic_libraries() is called. But GC_cond_add_roots() is not 
called.
The below code in GC_register_dynamic_libraries is never 
invoked(DEBUG_VIRTUALQUERY  is defined).
#               ifdef DEBUG_VIRTUALQUERY
                  GC_dump_meminfo(&buf);
#               endif
So, I add GC_dump_meminfo(&buf) before 'new_limit = (char *)p + buf.RegionSize;'
Now, it can output some message about buf:
BaseAddress = 10000, AllocationBase = 10000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 11000, AllocationBase = 10000, RegionSize = 2000(8192)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 13000, AllocationBase = 10000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 14000, AllocationBase = 10000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 15000, AllocationBase = 10000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 16000, AllocationBase = 10000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 17000, AllocationBase = 10000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 18000, AllocationBase = 10000, RegionSize = b000(45056)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 23000, AllocationBase = 20000, RegionSize = 5000(20480)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 28000, AllocationBase = 20000, RegionSize = 2000(8192)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 2a000, AllocationBase = 20000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 2b000, AllocationBase = 20000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 2c000, AllocationBase = 20000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 2d000, AllocationBase = 20000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 2e000, AllocationBase = 20000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 1000, Protect = 4, Type = 20000
BaseAddress = 2f000, AllocationBase = 20000, RegionSize = 2000(8192)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 31000, AllocationBase = 30000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 1000, Protect = 4, Type = 20000
BaseAddress = 32000, AllocationBase = 30000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 33000, AllocationBase = 30000, RegionSize = 3000(12288)
	AllocationProtect = 1, State = 1000, Protect = 4, Type = 20000
BaseAddress = 36000, AllocationBase = 30000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 37000, AllocationBase = 30000, RegionSize = 4000(16384)
	AllocationProtect = 1, State = 1000, Protect = 4, Type = 20000
BaseAddress = 3b000, AllocationBase = 30000, RegionSize = 5000(20480)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 40000, AllocationBase = 40000, RegionSize = 3000(12288)
	AllocationProtect = 1, State = 1000, Protect = 4, Type = 20000
BaseAddress = 43000, AllocationBase = 40000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 44000, AllocationBase = 40000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 45000, AllocationBase = 40000, RegionSize = 5000(20480)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 1000000
BaseAddress = 4a000, AllocationBase = 40000, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 4b000, AllocationBase = 0, RegionSize = 5000(20480)
	AllocationProtect = 1, State = 10000, Protect = 1, Type = 20000
BaseAddress = 50000, AllocationBase = 50000, RegionSize = f000(61440)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 20000
BaseAddress = 5f000, AllocationBase = 50000, RegionSize = 2000(8192)
	AllocationProtect = 1, State = 1000, Protect = 4, Type = 20000
BaseAddress = 61000, AllocationBase = 60000, RegionSize = e000(57344)
	AllocationProtect = 1, State = 2000, Protect = 1, Type = 20000
BaseAddress = 6f000, AllocationBase = 0, RegionSize = 1000(4096)
	AllocationProtect = 1, State = 10000, Protect = 1, Type = 20000
BaseAddress = 70000, AllocationBase = 70000, RegionSize = 96000(614400)
	AllocationProtect = 1, State = 1000, Protect = 2, Type = 20000
BaseAddress = 106000, AllocationBase = 0, RegionSize = a000(40960)
	AllocationProtect = 1, State = 10000, Protect = 1, Type = 20000
BaseAddress = 110000, AllocationBase = 110000, RegionSize = 50000(327680)
	AllocationProtect = 1, State = 1000, Protect = 4, Type = 20000
BaseAddress = 160000, AllocationBase = 0, RegionSize = 3fea0000(1072300032)
	AllocationProtect = 1, State = 10000, Protect = 1, Type = 20000
GC Warning: Thread stack pointer 0005FADC out of range, pushing everything
***Static roots:
Total size: 0

***Heap sections:
Total heap size: 65536
Section 0 from 00140000 to 00150000 0/16 blacklisted

***Free blocks:
Free list 16:
	00140000 size 65536 not black listed
Total of 65536 bytes on free list

***Blocks in use:
(kind(0=ptrfree,1=normal,2=unc.):size_in_bytes, #_marks_set)

blocks = 0, bytes = 0

I used a custom wince 6(for a EBook). But this problem is not exist on wince 
emulator with visual studio and HTC TouchHD device.
> 
> > I try to Add the code below:
> > FormatterFactory::formatterFactory = edp_new FormatterFactory();
> > GC_add_roots(&formatterFactory, &formatterFactory+4);
> >
> > Then the program don't crash on that point.
> >
> > I saw the code below in gc:
> > # ifdef MSWINCE
> >   /* Do we need to separately register the main static data segment? */
> >   GC_bool GC_register_main_static_data(void)
> >   {
> >     return FALSE;
> >   }
> > # else /* win32 */
> >
> > it simply return FALSE. Is this right?
> 
> Yes, this is correct (GC_register_main_static_data should return TRUE only for 
obsolete win32s). The
> real work is done by GC_register_dynamic_libraries().
> 
> Bye.
> 






More information about the Gc mailing list