title: Proper way to clear Realm table/database?
body: <p>I have a realm object with ~30 fields, after adding and removing several objects it seems that realm takes up quite a bit amount of space. The size of the allocated space seems to grow somewhat exponentially:</p>
  
  <p>10*(add 100 + remove all) = 4 mb Data</p>
  
  <p>15*(add 100 + remove all) = 33 mb Data</p>
  
  <p>20*(add 100 + remove all) = 91 mb Data</p>
  
  <p>25*(add 100 + remove all) = 179 mb Data</p>
  
  <p><img src="https://i.imgur.com/GVnDe40.png" alt="image"></p>
  
  <p>The file itself in data\data\app_folder\files\default.realm is 200 mb at this point.</p>
  
  <p>Now this serious issue might be because i am not doing something properly. Before every insertion i do </p>
  
  <pre><code>Realm realm = Realm.getInstance(context);
  
  realm.beginTransaction();
  realm.where(RealmSubmission.class).findAll().clear();
  // if i use realm.allObjects(RealmSubmission.class).clear(); the leak is even bigger, i get to 170mb Data with 20*(add 100 + remove all) even though both calls do the same by looking at their semantics.
  realm.commitTransaction();
  </code></pre>
  
  <p>Adding items into realm looks like this:</p>
  
  <pre><code>    for (Submission submission : submissionList){
          realm.beginTransaction();
  
          RealmSubmission realmSubmission = realm.createObject(RealmSubmission.class);
          RealmObjectUtils.copySubmission(realmSubmission, submission);
  
          realm.commitTransaction();
      }
  </code></pre>
  
  <p>Any ideas?</p>