Unit 'heaptrc' Package
[Overview][Constants][Types][Procedures and functions][Index] [#rtl]

Reference for unit 'heaptrc'

Heap debugging functionality.

uses

  System;

  

The system unit.

Overview

This document describes the HEAPTRC unit for Free Pascal. It was written by Pierre Muller. It is system independent, and works on all supported systems.

The HEAPTRC unit can be used to debug your memory allocation/deallocation. It keeps track of the calls to getmem/freemem, and, implicitly, of New/Dispose statements.

When the program exits, or when you request it explicitly. It displays the total memory used, and then dumps a list of blocks that were allocated but not freed. It also displays where the memory was allocated.

If there are any inconsistencies, such as memory blocks being allocated or freed twice, or a memory block that is released but with wrong size, this will be displayed also.

The information that is stored/displayed can be customized using some constants.

Do not use this unit directly, instead use the -gh switch, to let the compiler insert the unit in the uses clause. You can detect whether the heaptrc unit is actually used in the main program code with the following function:

function IsHeapTraceActive : boolean;

begin
{$if declared(UseHeapTrace)}
  Result:=UseHeapTrace;
{$else}
  Result:=False;
{$endif}
end;

Related topics

environment

  

Controlling HeapTrc with environment variables.

usage

  

HeapTrc Usage.


Documentation generated on: Nov 24 2024