[fpc-devel] Possible memory leak in cthread.
    Jonas Maebe 
    jonas.maebe at elis.ugent.be
       
    Wed Aug  5 14:19:56 CEST 2009
    
    
  
On 05 Aug 2009, at 13:55, Wimpie Nortje wrote:
> program memleak;
>
> {$mode objfpc}{$H+}
>
> uses
> cthreads;
>
> begin
> end.
>
> If I run the program using valgrind I get the following output:
> ==1944==    Invalid free() / delete /  
> delete[]                                                              
> ==1944==    at 0x4025DFA: free (vg_replace_malloc.c:323)              
> ==1944==    by 0x4171664: (within /lib/tls/i686/cmov/libc-2.9.so)
> ==1944==    by 0x4020422: _vgnU_freeres (vg_preloaded.c:60)
> ==1944==    by 0x40E5B23: _Exit (in /lib/tls/i686/cmov/libc-2.9.so)
> ==1944==    by 0x405C77C: (below main) (in /lib/tls/i686/cmov/ 
> libc-2.9.so)
> ==1944==  Address 0xffffffff is not stack'd, malloc'd or (recently)  
> free'd
This invalid free is probably the reason for the memory leak.
It even happens for this program:
{$linklib c}
begin
end.
There is probably some error in FPC's startup code (the code in fpc/ 
rtl/linux/i386/cprt0.as) which doesn't initialise some libc pointer.  
You should indeed report a bug about this.
To Graeme and Michael: heaptrc is useless/irrelevant to analyse memory  
leaks reported inside libc. Such errors can always be due to wrong  
usage of the C library from within FPC code.
Jonas
    
    
More information about the fpc-devel
mailing list