Critique my heap debugger

后端 未结 5 1527
梦谈多话
梦谈多话 2021-01-03 03:06

I wrote the following heap debugger in order to demonstrate memory leaks, double deletes and wrong forms of deletes (i.e. trying to delete an array with delete p

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-03 03:55

    Instead of doing intrusive note-keeping you could keep a list of all allocations made. Then you can free the memory without destroying your own data, and keep track of how many times a particular address is "deleted", and also find places where the program tries to delete a non-matching address (i.e. not in the list).

提交回复
热议问题