title: Using Valgrind on the iPhone Simulator on Mac OS X Snow Leopard
body: <p>Due to seeing random memory crashes in my iOS program, I decided to use Valgrind to help root out the problem, as they have a port that runs on the 32-bit mac OS X. I followed the instructions in this web page to set up Valgrind on the iPhone simulator here:</p>
  
  <p><a href="http://landonf.bikemonkey.org/code/iphone/iPhone_Simulator_Valgrind.20081224.html" rel="noreferrer">http://landonf.bikemonkey.org/code/iphone/iPhone_Simulator_Valgrind.20081224.html</a></p>
  
  <p>However, although I can get the program to compile in the iOS simulator, and the preprocessor flags set, I could not get Valgrind to actually run my program. It always quits with the following error:</p>
  
  <pre><code>valgrind: /Users/megahub/Library/Application Support/iPhone Simulator/4.2/Applications/6FD1FFF3-0EFB-4D81-A95A-F02E0AA9095E/QuamStockAdHoc.app/QuamStockAdHoc: cannot execute binary file
  
  cannot execute binary file
  </code></pre>
  
  <p>How can I resolve this problem? I've verified that the executable is present at that path, because I can run it without Valgrind in the simulator.</p>