Why is my program encountering a memory access violation?

  • Thread starter Thread starter Pattielli
  • Start date Start date
AI Thread Summary
The discussion revolves around troubleshooting a program that compiled without errors but encountered a memory access violation during debugging. The user is seeking clarification on the call stack and the presence of question marks in the memory window. It is explained that the call stack represents a sequence of function calls, crucial for tracking program execution, especially in recursive functions. The question marks in the memory window indicate either uninitialized memory or protected memory locations. Suggestions for debugging include setting breakpoints and monitoring variable values, but the user still struggles to resolve the issue. Overall, the conversation highlights the importance of understanding debugging tools in MS VC++ for effective problem-solving.
Pattielli
Messages
296
Reaction score
0
My program compiled without any errors...I tried to debug and just on the way to finishing the debugging process, it unforutunately ran into memory access violation. I turned on the memory but there were only question marks, I checked the call stack and as the picture enclosed below already showed you, main function and mainCRTStartup were there, written in a way I don't really understand...
Please take a look at it, I have two questions which I am looking for some ideas intructions or solutions to. What is written in that call stack window ? And why are there so many question marks in the memory window ?

Thank you very much,
 

Attachments

  • LetGo.PNG
    LetGo.PNG
    3.3 KB · Views: 507
Computer science news on Phys.org
I think my program didn't work because of my errors in coding, i made this question only to ask for some information about MS VC++ functions which I am really new to especially the debugger...
If you have any ideas, please just tell me...

Thank you
 
The easiest way to find bugs in your code is to setup a breakpoint and walk through the program step by step. You can also drag variables to the watch area and see how they change values.
 
Thank you, i set up a break point and jumped to the code that led to the error but still unable to fix it...

I have some questions as mentioned in my original post about what is written in the image that I really needs some explanation...if you don't care spending some moments having a look at it...
Again thank you very much,
 
The call stack is just what it is - a stack filled with function calls. For instance, when you have a recursive function, each time the function is called it is pushed onto the stack. Everytime you exit a function it is popped off the stack. It is basically a way for the computer to track where you are and where it has to go when a function is exited.

The questions marks mean that there is nothing there or the memory locations are protected.
 
Thank you for your explanation
 
Sorry if 'Profile Badge' is not the correct term. I have an MS 365 subscription and I've noticed on my Word documents the small circle with my initials in it is sometimes different in colour document to document (it's the circle at the top right of the doc, that, when you hover over it it tells you you're signed in; if you click on it you get a bit more info). Last night I had four docs with a red circle, one with blue. When I closed the blue and opened it again it was red. Today I have 3...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top