Skip to content

[Form] Memory leak in EntityType when using phppm #23975

Closed
@zmitic

Description

@zmitic
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? yes
Symfony version 3.3.5

I am playing around with phppm and found memory leak in EntityType::class. This ticket on phppm repository explains the problem in details.

In short, EntityType caches results in local property so same query will not be executed more than once. Given that I do $em->clear() in kernel.terminate event (otherwise, identity map would quickly fill up), I get exception on next request when submitting the same form.

I am reporting this as bug and not a feature request because I saw other tickets about memory leaks being reported the same.


This might sound funny but what if a service is tagged with for example memory_clean, it would need to implement MemoryCleanInterface with only clean() method.

And on kernel.terminate event, this method would be called on all these services. It could be done with a simple listener but this would bring consistency for future bundles when local caching is needed.

What do you think?

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