RAD Studio (Common)
ContentsIndex
PreviousUpNext
Managing Memory

This section provides how-to information on using the Memory Manager, covering how to configure the Memory Manager, increase the memory address space, monitor the Memory Manager, use the memory map, share memory, and report and manage memory leaks.

Name 
Description 
This section describes how to configure the Memory Manager.
Note: You can change some memory manager configuration settings while the Memory Manager is in use. All the configuration settings are global settings and affect all threads that are using the Memory Manager. Unless otherwise stated, all functions and procedures are thread safe.
These configuration options are for the local Memory Manager only. Setting these options inside a library when the library is sharing the Memory Manager of the main application will have no effect.
 
This section describes how to extend the address space of the Memory Manager beyond 2 GB.
Note: The default size of the user mode address space for a Win32 application is 2GB, but this can optionally be increased to 3GB on 32-bit Windows and 4GB on 64-bit Windows. The address space is always somewhat fragmented, so it is unlikely that a GetMem request for a single contiguous block much larger than 1GB will succeed – even with a 4GB address space.
 
This section describes how to monitor the state of the Memory Manager.
The Memory Manager provides two procedures that allow the application to monitor its own memory usage and the state of the process’ address space. Both functions are thread safe. 
This section describes how to register and unregister expected memory leaks.
When you allocate memory that you don't expect to free, you can register it with the Memory Manager. The Memory Manager adds it to a list of areas to ignore when it checks for memory leaks. When you unregister a memory location, the Memory Manager removes it from its list of expected memory leaks. 
This section describes how to share memory using the Memory Manager. On Win32, if a DLL exports routines that pass long strings or dynamic arrays as parameters or function results (whether directly or nested in records or objects), then the DLL and its client applications (or DLLs) must all share the same memory manager. The same is true if one application or DLL allocates memory with New or GetMem which is deallocated by a call to Dispose or FreeMem in another module. There are two mutually exclusive methods through which the Memory Manager can be shared between an application and... more 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!