[fpc-devel] HEAP Memory Manager BUG

Helmut Hartl fpc_devel at firmos.at
Fri Jul 15 23:15:36 CEST 2005


Hello,

We are trying to port a Project around 220.000 Lines of code from
Delphi/Kylix to FPC. Primary it runs :-), our main problems were Variant
Support (Various conversions behaving not as in Delphi/Kylix). We made an
own Variant Manager (to not break the existing one ) which is closer to
Delphi, we would like to contribute if we are done with it.

The biggest problem still not solved is a BUG in the heap memory manager
wich causes various SIGSEGV in various pieces of code i reported it
yesterday as BUG 4189. (http://www.freepascal.org/bugs/showrec.php3?ID=4189)

I want to supply additional info:

Program test;
var s:string;
begin
 setlength(s,3);
 setlength(s,655360); -> CRASHES WITH SIGSEGV  
 writeln('OK'); 
end;
Compile with: fpc -Sdh test.pas

Program crashes under linux and win32 with current SVN 2.1.1
Problem seems to be in:


function SysTryResizeMem(var p: pointer; size: ptrint): boolean;

We "FIXED" it by changing function to:

function SysTryResizeMem(var p: pointer; size: ptrint): boolean; var
  pcurrsize,
  oldsize,
  currsize : ptrint;
  pcurr : pmemchunk_var;
begin
  SysTryResizeMem := false;
exit;      <----------- Don't Resize
 .....

Thanks for the good work,

Helmut






More information about the fpc-devel mailing list