Sign in Join
FPDoc Onlineexperiment

cmem unit

Memory manager replacement using the C memory manager.

The cmem memory manager sets the system units memory manager to a C-based memory manager: all memory management calls are shunted through to the C memory manager, using Malloc, Free and ReAlloc. For this reason, the cmem unit should be the first unit of the uses clause of the program.

The unit also offers the C memory calls directly as external declarations from the C library, but it is recommended to use the normal FPC routines for this.

Obviously, including this unit links your program to the C library.

Note that specifying the -gv command-line option, to enable valgrind debugging info will implicitly add this unit to your program.

Procedures and functions

CAllocfunctionAllocate memory based on item size and count.
FreeprocedureFree a previously allocated block.
MallocfunctionMalloc external declaration.
ReAllocfunctionReallocates a memory block.

Constants

LibNameconstantName of the library used.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.