Base class for a memory manager used in the LCL and its interfaces.

lclmemmanager.pas contains classes and type used to define the base class for various memory managers used in the Lazarus Component Library (LCL) and its interfaces. An own memory manager is somewhat faster and makes debugging and profiling easier.

This file is part of the Lazarus Component Library (LCL).

Author: Mattias Gaertner

Pointer to a TLCLMemManagerItem type. Represents a memory manager item with a pointer to the next item in the list. Pointer to the next item in the memory manager. Template for memory manager implementations.

TLCLMemManager is a class which provides a template for memory manager implementations used in the LCL. It is used as a base class for specialized memory managers in widgetset classes.

Sets the value for the MaximumFreeCountRatio property. New value for the property. Sets the value for the MinimumFreeCount property. New value for the property. Internal member with the pointer the first item in the memory manager. Member used to store the value for the FreeCount property. Member used to store the value for the Count property. Member used to store the value for the MinimumFreeCount property. Member used to store the value for the MaximumFreeCountRatio property. Member used to store the value for the AllocatedCount property. Member used to store the value for the FreedCount property. Maintains values in FreeCount and Count when the memory manager item is freed. Pointer to the memory manager item. Gets a pointer to a free memory manager item, or creates a new one. Pointer to the new memory manager item. Frees the first item in the memory manager and maintains the list. Minimum block size that can be freed in the memory manager. Threshold which determines if the memory manager marks a block or frees it. Total number of items in the memory manager list. Number of items marked as free in the list. Number of items allocated in the memory manager list. Number of freed memory blocks in the list. Frees all items in the memory manager list.

Called from the destructor for the class instance.

Constructor for the class instance.

Calls the inherited constructor on entry, and sets the default values for properties in the class instance.

Destructor for the class instance.

Calls Clear to remove all items in the memory manager list. Calls the inherited destructor prior to exit.

Defines an object procedure type used to enumerate memory manager items. Pointer to a memory manager item enumerated in the procedure. A memory manager for records without freeing. Public member used to control zero-filling memory allocated for items. Used in the NewItem method. Size of the memory allocated for each item in the list. Frees memory allocated to items, and frees the list. Constructor for the class instance.

Sets ItemSize to the value specified in TheItemSize, and sets the size of the first item to 4 times the ItemSize value.

Destructor for the class instance.

Calls Clear on entry. Calls the inherited destructor prior to exit.

Gets a Pointer to a new item in the list. Pointer to the item added to the internal list. Enumerates items in the list using the specified object procedure. Object procedure used to enumerate the items in the list. Alias to the type used for stream sizes.

PtrInt for FPC 2.04.02 or higher. LongInt for versions prior to FPC 2.04.02.

Implements an extended memory stream with a minimum growth factor. Reallocates memory for the stream using the specified capacity.

Realloc is an overridden method in TExtMemoryStream. It ensures that the new Capacity is at least 25% larger than the existing Capacity. Realloc calls the inherited method to re-allocate memory to the size needed.

TMemoryStream
Pointer to the newly allocated memory for the stream. New capacity requested in the method. Size of the allocated memory for the stream.

Capacity is a public PtrInt property in TExtMemoryStream which contains the memory size allocated for the stream. Setting a new value for the property causes the Realloc method to be called to re-allocate memory to the requested value.