Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Breaking the debugger whenever delete/delete[] is called in C++

I might be missing something very trivial but is there a way to pause/break the debugger whenever any delete or delete[] is called? I tried Debug->New Breakpoint->Function Breakpoint (typed in delete as the function name) but it doesn't really trigger.

Thanks in Advance!

like image 585
Renz Edward Sui Avatar asked Dec 10 '22 04:12

Renz Edward Sui


1 Answers

delete and delete[] are operators in expressions, not functions.

They do however call operator functions that can be overloaded (and used to set breakpoint on). These are named operator delete and operator delete[].

like image 82
Some programmer dude Avatar answered Dec 12 '22 17:12

Some programmer dude