Registering Memory Leaks

From RAD Studio
Jump to: navigation, search

Go Up to Managing Memory Index


This section describes how to register and unregister expected memory leaks on 32-bit Windows and 64-bit Windows. Other platforms use the Posix/32 memory manager, which does not support this functionality.

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.

To register an expected memory leak:

  1. Identify the pointer to the memory area you don't expect to free.
  2. Pass the pointer to RegisterExpectedMemoryLeak.

To unregister an expected memory leak

  1. Identify the pointer to the memory area you want to unregister.
  2. Pass the pointer to UnregisterExpectedMemoryLeak.

See Also