# Windows C/C++ Dynamic Memory Interface Replacement

Replacements are provided by a proxy library (release version `tbbmalloc_proxy.dll`, debug version `tbbmalloc_debug_proxy.dll`). Replacement can be done in one of two ways:

- Add the following header to a source code of any binary which is loaded during application startup.

      #include "tbb/tbbmalloc_proxy.h"

- Alternatively, add the following parameters to the linker options for the .exe or .dll file that is loaded during application startup.

  For 32-bit code (note the triple underscore):

      tbbmalloc_proxy.lib /INCLUDE:"___TBB_malloc_proxy"

  For 64-bit code (note the double underscore):

      tbbmalloc_proxy.lib /INCLUDE:"__TBB_malloc_proxy"

The proxy library implements the following dynamic memory functions:

- Standard C run-time dynamic memory functions: `malloc`, `calloc`, `realloc`, `free`

- Global C++ operators `new` and `delete`.

- Microsoft* C run-time library function `_msize`

A directory with the proxy library and the appropriate scalable memory allocator library must be available for loading. For example, include the directory in `%PATH%`.

Parent topic: Automatically Replacing malloc and Other C/C++ Functions for Dynamic Memory Allocation