When working in C++ you often get unexplained memory exceptions. At least at first it might seem like random and unexplained memory exceptions. But when you pay closer attention you notice that the value of the pointer actually has meaning.
At least it does when you are using the Visual Studio Debugger. Below is a list that I hope you will find useful with the most common memory exceptions and their meaning.
- Memory violation at address 0xcdcdcd
In almost all cases this means that the pointer has not yet been initialized. So if you see it you forgot to nullify the pointer or didn’t create a new instance of a class for it.
- Memory violation at address 0xdddddd
The memory has been deleted but the pointer was not yet nullified
- Memory violation at address 0xfeeefeee
This pointer is no longer valid. You basically already deleted the memory that the pointer is for. Thus creating an error since the pointer was not nullified properly.
- Memory violation at address 0xccccccc (C++ v6 only)
The memory has not been initialized yet. Please do so 😉
Knowing what a memory location means is the first half of solving the problem causing it. The second step is walking through the call stack to try and locate the actual location of the problem.
Some errors I always made were deleting a string in a calling function and again in the function being called. A big noonoo :D.