title: Memory leak after persisting the object into GAE Datastore
body: <p>Could you guys please help me find memory leak ? I'm from C++ world and memory leaks in Java are kinda strange thing to me since according to my code I keep no references to temporary object.</p>
  
  <p>I'm using GAE SDK 1.6.1 and Objectify 3.1.</p>
  
  <p>I have following method which is being executed in backend instance of GAE dev server (which is probably irrelevant info to the issue).</p>
  
  <pre><code>private void loadProtoBufdata() throws Exception
  {
      ObjectifyDAO dao = new ObjectifyDAO();
  
      for (long count = 0; count &lt; 100; ++count)
      {
          Visitor visitor = new Visitor();
          visitor.setKey(count + 1);
          dao.ofy().put(visitor);
      }
  
      dao = null;
  }
  </code></pre>
  
  <p>In constructor of ObjectifyDAO it's being initialized as</p>
  
  <pre><code>public ObjectifyDAO()
  {
      super(new ObjectifyOpts().setSessionCache(false).setGlobalCache(false));
  }
  </code></pre>
  
  <p>And <code>Visitor</code> is as simple as</p>
  
  <pre><code>public class Visitor
  {
      @Id
      Long key;
      Long ek;
      @Unindexed String ip;
      Date t;
      @Unindexed Long lzVisit;
  }
  </code></pre>
  
  <p>I'm using JProfiler 7.0.1 to catch memory leaks. After running this code I have few megabytes of <code>com.google.storage.onestore.v3.OnestoreEntity$PropertyValue</code> and <code>com.google.storage.onestore.v3.OnestoreEntity$Property</code>.</p>
  
  <p>I don't want to blow up this post so I uploaded screenshots from JProfiler.</p>
  
  <p>Reference tree is <a href="http://i43.tinypic.com/xpy0xy.png" rel="nofollow">here</a>. Allocation tree is <a href="http://i44.tinypic.com/6jjaps.png" rel="nofollow">here</a>.</p>
  
  <p>I found <a href="http://code.google.com/p/objectify-appengine/issues/detail?id=38" rel="nofollow">this bug</a> on Objectify's tracker and also <a href="http://groups.google.com/group/google-appengine-java/browse_thread/thread/afc98d9a853601d2" rel="nofollow">this thread</a> on Google Ground for GAE. So I'm not sure whose bug this is.</p>
  
  <p>Questions are:</p>
  
  <p>1) How to avoid memory leak?
  2) Does it happen in production?</p>
  
  <p>Thanks!!!</p>
  
  <p>PS. Nick, I know you are reading this. Please help :)</p>