Finding where allocation overruns occur



How can I find out where allocation overruns occur?


If a NULL is passed as the argument to the library "free" in a

  program compiled under Microsoft or Borland, it is simply ignored.

  However, BOUNDS-CHECKER will still trap on the "free" call.

This makes it possible to find where any non-string overruns of

  allocated memory are occurring. If you insert

   free((void *)0);

  statements in your code at strategic intervals, and enable the

  Verbose Data switch, BOUNDS-CHECKER will check for the overrun at

  each of the "free" statements. This will enable you to narrow down

  where the overrun occurred to a range of code between the "free"

  where the overrun is reported and the one preceding it. Additional

  "free" statements can be put into this range as needed to locate

  the overrun more precisely.

Old KB# 12302
Comment List
Related Discussions