Link to home
Start Free TrialLog in
Avatar of cancel_t

asked on

Debugger help

Hi all,

I am trying to debug a weird problem in my code. I am writing a multithreaded application. I have descovered that one of my the variables shared by the threads changes values during execution of the program (actually it is set to zero). This happens at the same point in the code everytime. During the debugging I noticed that at the same time the variable changes value, another location memory also changes (these changes are highlighted red by the debugger).

My question is: Is there a what to tell what variable is stored in that memory location without having to check every variable in my code?

Side points: I suspect this is happening because I have corrupted the heap. However, I am new to multithreaded programing and I have looked through my code and cannot find where I have made a mistake. Any tips on debugging multhreaded programs using Visual Studio 2008 would be much appreciated.

Lastly, I use critical sections to write to shared variables, but not to read them. Is this okay, or do I have to use critical sections to read a shared variable as well?
Avatar of mjoachiamiak
Flag of Finland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cancel_t


I have abonded the code because of the problem. When I have more time I will do some reading on multithreaded programming.