title: Symfony CreateForm function runs out of memory
body: <p>I'm working on a 2.8 symfony project and I can't solve a problem I've been dealing with for a few weeks.</p>
  
  <p>Every form I'm trying to create gets me a "Allowed memory size exhausted" error. This should be a configuration problem because my project is working on dev and prod environments, and on other computers. It's just not working on mine.</p>
  
  <blockquote>
    <p>Error exemple : OutOfMemoryException in BundleEntryReader.php line
    134:</p>
    
    <p>Error: Allowed memory size of 134217728 bytes exhausted (tried to
    allocate 134217736 bytes)</p>
  </blockquote>
  
  <p>I'm working on Ubuntu. I tried remove and re-install both apache and php (7.1), but no success. I also tried to allow more memory and execution time, but my scripts keep running for dozens of minutes.</p>
  
  <pre class="lang-php prettyprint-override"><code>$projectForm = $this-&gt;createForm(
       new ProjectType($choices, $user-&gt;getCompany()),
       $project,
       ['action' =&gt; $this-&gt;generateUrl('company_project_create',['projectId' =&gt; $project-&gt;getId() ])]
  );
  </code></pre>
  
  <p>I'd like to be able to generate a form. the problem is in the form generation. In every script I use, evrything is ok until the "$this->createForm()" function. Let's says that this application runs on computers with less ram.</p>
  
  <p>/*****EDIT*****/</p>
  
  <p>I found that the problem came from two types in my ProjectType : user and address : </p>
  
  <pre class="lang-php prettyprint-override"><code>$builder            
       -&gt;add('user', UserType::class, [
            'label' =&gt; 'customer.user.label',
       ])
       -&gt;add('address', ProjectAddressType::class, [
            'label' =&gt; 'customer.project.address.label',
       ])
  </code></pre>
  
  <p>Here is for example where my userType has problem : </p>
  
  <pre class="lang-php prettyprint-override"><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
       parent::buildForm($builder, $options);
       $builder
            -&gt;add('photo', HiddenType::class, ['required'    =&gt; false])
            -&gt;add('isSendDailyMail', CheckboxType::class, [
                'label'    =&gt; false,
                'required' =&gt; false,
       ]);
  }
  </code></pre>