Finding unused memory in process memory : <p>I'm looking for a reliable way to find <code>unused memory</code> in a <code>C</code> program's process since I need to "inject" some data into somewhere without it corrupting anything.</p>

<p>Whenever I find an area with only zeros in it, that's a good sign. However, no guarantees: It can still crash. All the non-zero memory is most likely being used for sure so it cannot be overwritten reliably (most memory has some kind of data in it).</p>

<p>I understand that you can't really know (without having the application's source code for instance) but are there any heuristics that make sense such as choosing certain segments or memory looking a certain way? Since the data can be <code>200KB</code> this is rather large and finding an appropriate address range can be difficult/tedious.</p>

<p>Allocating memory via OS functions doesn't work in this context.</p>
