vpp: use vpp heap for libc
[vpp.git] / src / vpp / mem / mem.md
1 # VPP mem preload {#mempreload_doc}
2
3 Internal VPP memory allocations rely on VPP main-heap, however when using
4 external libraries, esp. in plugins (eg. OpenSSL library used by the IKEv2
5 plugin), those external libraries usually manages memory using the standard
6 libc `malloc()`/`free()`/... calls. This, in turn, makes use of the default
7 libc heap.
8
9 VPP has no knowledge of this heap and tools such as memory traces cannot be
10 used.
11
12 In order to enable the use of standard VPP debugging tools, this library
13 replaces standard libc memory management calls with version using VPP
14 main-heap.
15
16 To use it, you need to use the `LD_PRELOAD` mechanism, eg.
17 ```
18 ~# LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libvppmem_preload.so /usr/bin/vpp -c /etc/vpp/startup.conf
19 ```
20
21 You can then use tools such as memory traces as usual.