Re: [Gc]: Program broken
ivmai at mail.ru
Fri Sep 25 05:46:41 PDT 2009
Hugn <up2dream at gmail.com> 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 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).
> 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().
More information about the Gc