title: How to calculate fragmentation?
body: <p>Imagine you have some memory containing a bunch of bytes:</p>
  
  <pre><code>++++ ++-- ---+ +++-
  -++- ++++ ++++ ----
  ---- ++++ +
  </code></pre>
  
  <p>Let us say <code>+</code> means allocated and <code>-</code> means free.</p>
  
  <p>I'm searching for the <strong>formula</strong> of how to calculate the <strong>percentage of fragmentation</strong>.</p>
  
  <p><strong>Background</strong></p>
  
  <p>I'm implementing a tiny dynamic memory management for an embedded device with static memory. My goal is to have something I can use for storing small amounts of data. Mostly incoming packets over a wireless connection, at about 128 Bytes each.</p>