I'm writing a debug versions of global delete/new operator to detect memory leaks, double deletes and delete on unallocated memory.
As far as "new" operator is concerned, I overrode the global new operator and using macros I passed file name and line number information. The overridden "new" operator stores the memory address, file name, size and line number information in map keyed on address.
I overrode "delete" operator too, which removes the deleted address' entry from the map. Now i want to store the deleted memory information in another map which stores the file name and line number information from where the "delete" was called.
But the delete operator takes only argument (memory address of the object to be deleted). Can someone tell how to detect double deletes in the code?