|
@@ -548,31 +548,29 @@ end;
|
|
|
|
|
|
function TraceMemSize(p:pointer):ptrint;
|
|
function TraceMemSize(p:pointer):ptrint;
|
|
var
|
|
var
|
|
- l : ptrint;
|
|
|
|
pp : pheap_mem_info;
|
|
pp : pheap_mem_info;
|
|
begin
|
|
begin
|
|
pp:=pheap_mem_info(p-sizeof(theap_mem_info));
|
|
pp:=pheap_mem_info(p-sizeof(theap_mem_info));
|
|
- l:=SysMemSize(pp);
|
|
|
|
- dec(l,sizeof(theap_mem_info)+pp^.extra_info_size);
|
|
|
|
- if add_tail then
|
|
|
|
- dec(l,sizeof(ptrint));
|
|
|
|
- TraceMemSize:=l;
|
|
|
|
|
|
+ TraceMemSize:=pp^.size;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TraceFreeMem(p:pointer):ptrint;
|
|
function TraceFreeMem(p:pointer):ptrint;
|
|
var
|
|
var
|
|
- size : ptrint;
|
|
|
|
|
|
+ l : ptrint;
|
|
pp : pheap_mem_info;
|
|
pp : pheap_mem_info;
|
|
begin
|
|
begin
|
|
pp:=pheap_mem_info(p-sizeof(theap_mem_info));
|
|
pp:=pheap_mem_info(p-sizeof(theap_mem_info));
|
|
- size:=TraceMemSize(p);
|
|
|
|
|
|
+ l:=SysMemSize(pp);
|
|
|
|
+ dec(l,sizeof(theap_mem_info)+pp^.extra_info_size);
|
|
|
|
+ if add_tail then
|
|
|
|
+ dec(l,sizeof(ptrint));
|
|
{ this can never happend normaly }
|
|
{ this can never happend normaly }
|
|
- if pp^.size>size then
|
|
|
|
|
|
+ if pp^.size>l then
|
|
begin
|
|
begin
|
|
- dump_wrong_size(pp,size,ptext^);
|
|
|
|
|
|
+ dump_wrong_size(pp,l,ptext^);
|
|
{$ifdef EXTRA}
|
|
{$ifdef EXTRA}
|
|
- dump_wrong_size(pp,size,error_file);
|
|
|
|
|
|
+ dump_wrong_size(pp,l,error_file);
|
|
{$endif EXTRA}
|
|
{$endif EXTRA}
|
|
end;
|
|
end;
|
|
TraceFreeMem:=TraceFreeMemSize(p,pp^.size);
|
|
TraceFreeMem:=TraceFreeMemSize(p,pp^.size);
|
|
@@ -718,14 +716,6 @@ var
|
|
edata : longword; external name 'edata';
|
|
edata : longword; external name 'edata';
|
|
{$endif go32v2}
|
|
{$endif go32v2}
|
|
|
|
|
|
-{$ifdef win32}
|
|
|
|
-var
|
|
|
|
- { I found no symbol for start of text section :(
|
|
|
|
- so we usee the _mainCRTStartup which should be
|
|
|
|
- in wprt0.ow or wdllprt0.ow PM }
|
|
|
|
- text_begin : longword;external name '_mainCRTStartup';
|
|
|
|
- data_end : longword;external name '__data_end__';
|
|
|
|
-{$endif}
|
|
|
|
|
|
|
|
procedure CheckPointer(p : pointer);[saveregisters,public, alias : 'FPC_CHECKPOINTER'];
|
|
procedure CheckPointer(p : pointer);[saveregisters,public, alias : 'FPC_CHECKPOINTER'];
|
|
var
|
|
var
|
|
@@ -1142,7 +1132,10 @@ finalization
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.31 2004-06-20 09:24:40 peter
|
|
|
|
|
|
+ Revision 1.32 2004-09-16 07:21:08 michael
|
|
|
|
+ Fix tracememsize for ansistrings (From Peter)
|
|
|
|
+
|
|
|
|
+ Revision 1.31 2004/06/20 09:24:40 peter
|
|
fixed go32v2 compile
|
|
fixed go32v2 compile
|
|
|
|
|
|
Revision 1.30 2004/06/17 16:16:13 peter
|
|
Revision 1.30 2004/06/17 16:16:13 peter
|