Re: [Gc] Win32 gc leaks memory(8 to 16 bytes)

Ivan Maidanski ivmai at mail.ru
Thu Oct 7 12:59:09 PDT 2010


Hans -

could you comment on this post?

Thu, 7 Oct 2010 15:02:17 +0000 (UTC) djamel magri
<djamel.magri at gmail.com>:

> Hi, 
> Env. : gc v.7.2alpha4, OS: XP, macros:
>
GC_NOT_DLL;ALL_INTERIOR_POINTERS;__STDC__;ENABLE_TRACE;GC_WIN32_THREADS
> Each collection leads to GC_add_current_malloc_heap()
call, allocating heap
> memory(pure c malloc), to distinguish malloc heap from gc
heap
> Some of them are never freed.
> A simple program with a GC_INIT() and GC_deinit(), with
GC_dont_precollect set
> to 0, shows the problem.
> GC_deinit only releases the critical section(by the way
GC_deinit is not part
> of
> gc.h API, it's in gc_priv.h...)
> I have coded this fix :
> void GC_deinit(void)
> {
> if (GC_print_stats)
> GC_log_printf("-->GC_deinit\n");
> if(GC_malloc_heap_l)
> {
> struct GC_malloc_heap_list* current = GC_malloc_heap_l;
> struct GC_malloc_heap_list* next = 0;
> do
> {
> next = current->next;
> free(current);	
> current = next;
> }while(next);
> GC_malloc_heap_l = 0;
> }	  
> if (GC_is_initialized)
> {
> DeleteCriticalSection(&GC_write_cs);
> }
> if (GC_print_stats)
> GC_log_printf("<--GC_deinit\n");
> }



More information about the Gc mailing list