From 668b4abdb4e055f3a0c0d92b60281234afc9bb6d Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 28 Apr 2009 22:30:27 +0000 Subject: [PATCH] LCL: TLCLNonFreeMemManager extended for 64bit git-svn-id: trunk@19675 - --- components/codetools/codetoolmemmanager.pas | 4 ++-- components/codetools/finddeclarationcache.pas | 12 ++++++++++++ components/codetools/finddeclarationtool.pas | 1 + lcl/lclmemmanager.pas | 12 ++++++++---- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/components/codetools/codetoolmemmanager.pas b/components/codetools/codetoolmemmanager.pas index 9bff3e4ae8..6ec1be362d 100644 --- a/components/codetools/codetoolmemmanager.pas +++ b/components/codetools/codetoolmemmanager.pas @@ -23,7 +23,7 @@ Abstract: Defines TCodeToolMemManager, which is the base class for the various memory manager in the codetools. An own memory manager is somewhat faster - and makes debugging and proiling easier. + and makes debugging and profiling easier. } unit CodeToolMemManager; @@ -72,7 +72,7 @@ type constructor Create; destructor Destroy; override; end; - + implementation diff --git a/components/codetools/finddeclarationcache.pas b/components/codetools/finddeclarationcache.pas index d944031cc6..ccf5014668 100644 --- a/components/codetools/finddeclarationcache.pas +++ b/components/codetools/finddeclarationcache.pas @@ -197,6 +197,9 @@ type //---------------------------------------------------------------------------- type + + { TGlobalIdentifierTree } + TGlobalIdentifierTree = class private FItems: TAVLTree; // tree of PChar; @@ -206,6 +209,7 @@ type procedure Clear; constructor Create; destructor Destroy; override; + function Count: integer; end; //---------------------------------------------------------------------------- @@ -579,6 +583,14 @@ begin inherited Destroy; end; +function TGlobalIdentifierTree.Count: integer; +begin + if FItems<>nil then + Result:=FItems.Count + else + Result:=0; +end; + function TGlobalIdentifierTree.AddCopy(Identifier: PChar): PChar; var Len: integer; begin diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index ac3ee2e205..e22345653b 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -5117,6 +5117,7 @@ begin // create nodes ScanChilds(InterfaceNode); + DebugLn(['TFindDeclarationTool.BuildInterfaceIdentifierCache ',MainFilename,' ',FInterfaceIdentifierCache.Items.Count,' ',GlobalIdentifierTree.Count]); Result:=true; end; diff --git a/lcl/lclmemmanager.pas b/lcl/lclmemmanager.pas index cdc3532041..c288061c8c 100644 --- a/lcl/lclmemmanager.pas +++ b/lcl/lclmemmanager.pas @@ -72,15 +72,17 @@ type TLCLNonFreeMemManager = class private - FItemSize: integer; + FItemSize: PtrInt; FItems: TFPList; FCurItem: Pointer; FEndItem: Pointer; - FCurSize: integer; - FFirstSize: integer; + FCurSize: PtrInt; + FFirstSize: PtrInt; + FMaxItemsPerChunk: PtrInt; public ClearOnCreate: boolean; - property ItemSize: integer read FItemSize; + property ItemSize: PtrInt read FItemSize; + property MaxItemsPerChunk: PtrInt read FMaxItemsPerChunk write FMaxItemsPerChunk; procedure Clear; constructor Create(TheItemSize: integer); destructor Destroy; override; @@ -229,6 +231,8 @@ begin if (FCurItem=FEndItem) then begin // each item has double the size of its predecessor inc(FCurSize,FCurSize); + if (FMaxItemsPerChunk>0) and (FCurSize>FMaxItemsPerChunk*FItemSize) then + FCurSize:=FMaxItemsPerChunk*FItemSize; GetMem(FCurItem,FCurSize); if ClearOnCreate then FillChar(FCurItem^,FCurSize,0);