Skip to content

Memory leak when using route annotation #32220

Closed
@goetas

Description

@goetas

Symfony version(s) affected: v4.3.2 (tested also 3.4 and 4.2, same issue)

Description
When a route is defined using annotations, there is a memory leak.
If the route is defined using YAML, there is no memory leak.

How to reproduce
I have created a basic symfony app available in https://github.com/goetas/symfony-mem-leak
The travis build showing the memory leak https://travis-ci.org/goetas/symfony-mem-leak/jobs/551313488

The test app has a basic controller as follows:

class DefaultController
{
    /**
     * @Route("/leak",name="getss")
     * @return Response
     */
    public function leak()
    {
        return new Response('hello');
    }

    public function noleak()
    {
        return new Response('hello');
    }
}

Requests to leak will result in a memory leak, requests to noleak will have no leaks.

The repo includes 2 scripts bin/runner-no-leak and bin/runner-no-leak that call 5000 times the two routes.

When bin/runner-leak is called, memory goes up.

In larger application memory goes up faster... apparently depending on the output of the method..

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions