Reputation: 21
My C++ application is using own library for memory management. It defines malloc and free and it is statically linked. My application uses few other 3rd party libraries also. I got a crash in one of those libraries in below API. /lib64/libc.so.6: realloc()
After analyzing I figured out that this is caused by my memory management library. Basically what was happening is that, a certain memory was allocated by my own memory manager and then later the same memory is being reallocated by libc.so. because of this mixing of memory managers, it caused the crash.
Once I remove my memory management library, all memory allocations are going through libc.so and issue is resolved.
But my question is that if I use my own memory management library, should not all code within the application use that memory manager? Or other static or shared libraries can still use libc.so? If yes, is there anyway I can force all other libraries to use my memory management library only.
Upvotes: 1
Views: 60