Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memory could not be "read"

Status
Not open for further replies.

arvaker

Programmer
Dec 21, 2005
1
ES
Hi, I am doing a programm to communicate serial ports. When I execute it from the Debug of the Visual C.net it works correctly. But if I execute it apart from the VC.net, it produces this error:

The instruction at [xxxx] referenced memory at [xxx] The memory could not be "read."
It is quite rare because it only brings errors if I execute it alone, and during the third time I want to read from the port. This made me suppose it could be buffer problems, but now I flush the buffer before the reading and the problem remains.
I do not know what is happening. I think it is a Microsoft's trouble.
I would be very pleased to you if you can help me.
Thanks, Álvaro
 
No way to know, but my experience says that you have a memory leak in your code, an access synchronization problem or something like that. The debugger is just hiding it, maybe because it's slower or because of the debug information on the compiled file.

I'd try executing it outside VC and including some output to console or a log file to determine where the problem is.

Cheers,
Dian
 
I get that sometimes as well. And it's usually because I've stepped beyond an array. I agree with Dian, you should include console output, log file or MessageBox to track down the culprit.


HyperEngineer
If it ain't broke, it probably needs improvement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top