title: How do I detect memory access violation and/or memory race conditions?
body: <p>I have a target platform reporting when memory is read from or written to as well as when locks(think mutex for example) are taken/freed. It reports the program counter, data address and read/write flag. I am writing a program to use this information on a separate host machine where the reports are received so it does not interfere with the target. The target already reports this data so I am not changing the target code at all.</p>
  
  <p>Are there any references or already available algorithms that do this kind of detection? For example, some way of detecting race conditions when multiple threads try to write to a global variable without protecting it first.</p>
  
  <p>I am currently brewing my own but I convince myself there is definitely some code out there that does this already. Or at least some proven algorithm of how to go about it.</p>
  
  <p><strong>Note</strong> This is not to detect memory leaks. </p>
  
  <p><strong>Note</strong> Implementation language is C++</p>
  
  <p>I am trying to make the detection code I write platform agnostic so I am using STL and just Standard C++ with libraries like boost, poco, loki.</p>
  
  <p>Any leads will help</p>
  
  <p>thanks.</p>