thready
asked on
Access violation writing location 0x00000108
Hi Experts!
How do I debug this? VS2012 MFC application. The assignment from atoi from the following line of code causes this:
int i = atoi(s.c_str());
I think there must be a buffer overrun or some kind of important memory at this location because the line of code is perfectly legit.
Thanks for your help!
Mike
How do I debug this? VS2012 MFC application. The assignment from atoi from the following line of code causes this:
int i = atoi(s.c_str());
I think there must be a buffer overrun or some kind of important memory at this location because the line of code is perfectly legit.
Thanks for your help!
Mike
The line looks OK, but what is the preceding code like? And where does the debugger take you when that exception is encountered?
ASKER
I'm in a function- the code before it is very uneventful- nothing that could be overwriting memory. It had to happen at some point from another function call...
The debugger just says unhandled exception - access violation when writing location ox108....
If there are tools on the market that can point out where in your code you're producing memory leaks or corrupting memory- is there a way to do this manually?
The debugger just says unhandled exception - access violation when writing location ox108....
If there are tools on the market that can point out where in your code you're producing memory leaks or corrupting memory- is there a way to do this manually?
Hmmm, what call stack does the debugger display? Any chance that that might happen in a different thread? And, does 's' contain a valid integer?
ASKER
There's only the main thread- I'm at the start of the application. s contains "6", so yep, that's cool.
As for the callstack, I'm in InitInstance- the mainframe is loading and I'm in the constructor of a toolbar window interface object. Not much has happened so far, which is good news...
As for the callstack, I'm in InitInstance- the mainframe is loading and I'm in the constructor of a toolbar window interface object. Not much has happened so far, which is good news...
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Not sure why, but I needed to rebuild all (it had not been long that I did one).... Now it works.... :(
Weird... but good that you found it.