
Stewart, Robert <Robert.Stewart <at> sig.com> writes:
Gennadiy Rozental wrote On Saturday, June 06, 2009 3:15 AM
I also have following functions in this module:
debugger_break - cause program to break execution in debugger at call point
[snip]
break_memory_alloc - cause program to break execution in debugger at specific allocation point
The function name connotes causing the following memory allocation(s) to fail,
which is useful in its own
right for testing error handling.
How is break_memory_alloc() different from debugger_break() in practical terms? IOW, if break_memory_alloc() causes a break at the next allocation, it doesn't seem any different than preceding the allocation call with debugger_break().
break_memory_alloc take as an argument concrete allocation index and it should break at this particular allocation. We may consider designing interface which will support breaking *next* allocation, but it's not there yet. Note that in both cases you actually do not know where the allocation occurs. The primary usage of this functionality is to help with memory leaks detection. Gennadiy