There are scenarios in which the MALLOC_ASSERT is hit in the scalable_allocator code. Now we have a custom mechanism for handling assertions in our code. Is there any way we can make MALLOC_ASSERT call our assertion mechanism? Does a simple #define MALLOC_ASSERT ... work in this case?
I think if you change the define of MALLOC_ASSERT in src/tbbmalloc/Customize.h and recompile tbbmalloc it will be enough. If you face some issues feel free to ask.
Just for curiosity, what scenarios cause MALLOC_ASSERT to be raised? Are the wrong arguments passed to tbbmalloc API?
So there is no other way than recompiling the sources. I expected this but unfortunately it is not the solution I was looking for :)
Anyways the asserts were caused because of a bug in my code. Thanks!
Assert code is usually associated with conditional jump (Jxx) instruction or CALL instruction. You may modify the operand (relative offset to target address of next instruction or memory pointer of target address) of the instruction for execution of your custom handler.
Alternately, you may set instruction breakpoint via debug register (up to 4 breakpoints only). Then modify the RIP/EIP register or the return address on the call stack (to skip the original assert handler) upon return from the handler of instruction breakpoint.