Memory management specification.

Copyright 1996 David Turner, Robert Wilhelm and Werner Lemberg.

This file is part of the FreeType project, and may only be used modified and distributed under the terms of the FreeType project license, LICENSE.TXT. By continuing to use, modify or distribute this file you indicate that you have read the license and understand and accept it fully.

Differences between 2.1 and 2.0:

- Added a memory mutex to make the component thread-safe.

Differences between 2.0 and 1.1:

- The growing heap was completely removed in version 2.0,
- The support for small mini-heaps may be re-introduced later to allow the storage of several consecutive arrays in one single block.

IMPORTANT NOTICE :

The Alloc and Free functions mimic their C equivalent, however, some points must be noticed:

- Both functions return a boolean. As usual, True indicates success, while False indicates failure.
- The Alloc function puts a small header on front of each allocated block. The header contains a magic cookie and the size of the allocated block. This allows calls to Free without passing a block size as an argument, and thus reduces the risks of memory leaks.
- It is possible to call Free with a nil pointer, in which case nothing happens, and the result is set to True (success).

The pointer is set to nil after a call to Free in all cases. This is done to clear the destructors code, allowing:

if (pointer) then begin Free(pointer); pointer := nil; end;

To be replaced by a single line:

Free(pointer);

Allocates a new memory block in the current heap of size bytes. Returns failure if no memory is left in the heap.

Releases a block previously allocated through Alloc. Returns True (success) if P is Nil before the call. Sets P to nil before exit.