[fpc-devel] issue in heaptrc?
    Martin 
    lazarus at mfriebe.de
       
    Thu Jan 26 06:37:03 CET 2012
    
    
  
I ve been playing around with -gc and I found something suspect in heaptrc
procedure CheckPointer(p : pointer); [public, alias : 'FPC_CHECKPOINTER'];
"p" is a pointer, that should be somewhere *inside* an allocated block 
of mem
   pp:=loc_info^.heap_mem_root;
   while pp<>nil do
    begin
      { inside this block ! }
      if 
(ptruint(p)>=ptruint(pp)+sizeof(theap_mem_info)+ptruint(extra_info_size)) and
         
(ptruint(p)<=ptruint(pp)+sizeof(theap_mem_info)+ptruint(extra_info_size)+ptruint(pp^.size)) 
then
if this loop does not find anything then
   writeln(ptext^,'pointer $',hexstr(p),' does not point to valid memory 
block');
   dump_error(p,ptext^);
   runerror(204);
but
   procedure dump_error(p : pheap_mem_info;var ptext : text);
expects a pheap_mem_info, p is not a pheap_mem_info
and that is where it crashes (shortly before dump stack trace :(  )
Did I miss something or is there a bug?
    
    
More information about the fpc-devel
mailing list