LD_PRELOADing malloc and free

前端 未结 1 1930
情深已故
情深已故 2020-12-22 04:31

I wrote my own malloc and free and compiled them in a shared library. I LD_PRELOAD that library with my program. In this way would my program always use my

相关标签:
1条回答
  • 2020-12-22 05:16

    Using LD_PRELOAD to override malloc etc. is expected to work; this is how e.g. DUMA works.

    In addition to malloc, calloc and free, make sure you override realloc, memalign and valloc. In addition you might need to override C++ new, new[], delete and delete[].

    See Overriding 'malloc' using the LD_PRELOAD mechanism for an example of how to do this right.

    0 讨论(0)
提交回复
热议问题