Why is my program encountering a memory access violation?

  • Thread starter Thread starter Pattielli
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around a programming issue related to a memory access violation encountered during debugging in MS VC++. Participants seek clarification on the call stack and the presence of question marks in the memory window, as well as general debugging strategies.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • One participant describes encountering a memory access violation and expresses confusion about the call stack and memory window contents.
  • Another participant suggests that coding errors may be the cause of the issue and requests information about MS VC++ functions and debugging.
  • A suggestion is made to set up breakpoints and step through the program to identify bugs, along with using the watch area for variable values.
  • A participant explains that the call stack tracks function calls and that question marks in the memory window indicate either uninitialized memory or protected memory locations.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the specific cause of the memory access violation, and multiple viewpoints regarding debugging strategies and interpretations of the call stack and memory window are presented.

Contextual Notes

Participants express uncertainty about the specifics of the call stack and memory window, indicating a need for further clarification on these concepts.

Who May Find This Useful

Individuals new to programming in MS VC++, particularly those unfamiliar with debugging techniques and memory management concepts.

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: 545
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
 

Similar threads

  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 10 ·
Replies
10
Views
6K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
4K
Replies
38
Views
10K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
6
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K