mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-04 00:43:54 +02:00
40 lines
697 B
ObjectPascal
40 lines
697 B
ObjectPascal
unit LazDbgLog;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils;
|
|
|
|
function MemSizeString(const s: string): PtrUInt;
|
|
function MemSizeFPList(const List: TFPList): PtrUInt;
|
|
function GetStringRefCount(const s: string): PtrInt;
|
|
|
|
implementation
|
|
|
|
function MemSizeString(const s: string): PtrUInt;
|
|
begin
|
|
Result:=length(s);
|
|
if s<>'' then
|
|
inc(Result,SizeOf(Pointer)*4);
|
|
end;
|
|
|
|
function MemSizeFPList(const List: TFPList): PtrUInt;
|
|
begin
|
|
if List=nil then exit(0);
|
|
Result:=PtrUInt(List.InstanceSize)
|
|
+PtrUInt(List.Capacity)*SizeOf(Pointer);
|
|
end;
|
|
|
|
function GetStringRefCount(const s: string): PtrInt;
|
|
begin
|
|
if s='' then
|
|
Result:=-1
|
|
else
|
|
Result:=PPtrInt(s)[-2];
|
|
end;
|
|
|
|
end.
|
|
|