title: Memory management Symfony forms and Doctrine
body: <p>When building a form using Symfony the build of the form is terribly slow and the memory spikes.</p>
  
  <p>The form is build using some subforms and uses some <code>one-to-many</code> relations. When the data of the form becomes larger (more entities in the many side) the form is slower and memory is usage is getting larger this seem okey though the amount of time and memory usage don't seem to.</p>
  
  <p>Example when having about 71 enities in the many side the memory usage is about 116 MB and takes 14 seconds to load.</p>
  
  <p>I already deduced the number of queries done (from 75 to 4) though the memory spike still happens the moment the form is created</p>
  
  <blockquote>
    <p><code>$form = $this-&gt;createForm(new TapsAndAppliancesType(), $taps);</code></p>
  </blockquote>
  
  <p>Any tips and tricks to speed this up?</p>