RTL.UsageTracker Sample

From RAD Studio Code Examples
Jump to: navigation, search

Language:

Contents

This sample demonstrates how to use information from the Delphi memory manager to graphically display the memory block allocation.

Location

You can find the Usage Tracker sample project at:

Description

This application consists of two forms. The first form allows the user to choose the minimum block alignment and then display the usage tracker itself, by clicking the Show Usage Tracker button. The usage tracker form contains a TDrawGrid component, used to graphically display the allocated blocks of memory in different colors, depending on their type. Below the TDrawGrid, two TEdit components display the address and state of the selected block. To the right of the form, a TStringGrid displays statistics about the allocated blocks, including their size, reserved memory, and efficiency.

How to Use the Sample

  1. Navigate to Start | Programs | Embarcadero RAD Studio | Samples and open UsageTrackerDemo.dproj.
  2. Press F9 or choose Run > Run.

Files

The project has two source files:

File Contains

DemoForm.pas

The class for the form that is displayed first when the application is run.

MemoryManagerUsageTracker.pas

The class for the usage tracker.

Classes

  • TfDemo is the class for the form that allows the user to choose the minimum block alignment and then to display the usage tracker form.
  • TfMemoryManagerUsageTracker is the class for the form that graphically displays memory allocation information. It retrieves data from the memory manager and displays it in a TDrawGrid component and a TStringGrid component.

Implementation

Uses

See Also

Personal tools