Out of memory error in symfony

You either disable symfony profiler (I don't think this is what you want as far as I know) or set limit to unlimited with -1 in your php.ini and restart apache.

memory_limit = -1

The most eager component in Symfony is a profiler. If you don't need profiler in some particular actions you can disable it via code:

if ($this->container->has('profiler'))
{
    $this->container->get('profiler')->disable();
}

You can also set global parameter in config:

framework:
    profiler:
        collect: false