Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear visitedCollections #703

Merged
merged 1 commit into from
Jun 30, 2013
Merged

Clear visitedCollections #703

merged 1 commit into from
Jun 30, 2013

Conversation

shulcsm
Copy link
Contributor

@shulcsm shulcsm commented Jun 19, 2013

Visited collections are cleared only in commit(). Commit clears up only if it actually has something to do. Processing large amounts of records without changing them cause visitedCollections to grow without any way of clearing.

Visited collections are cleared only in commit(). Commit clears up only if it actually has something to do. Processing large amounts of records without changing them cause visitedCollections to grow without any way of clearing.
@stof
Copy link
Member

stof commented Jun 19, 2013

could you add a test for this ?

@Ocramius
Copy link
Member

@stof can't really test this one since there's no way to access the visited collections...

@beberlei
Copy link
Member

This explains why some people have memory leaks even when using clear.

@beberlei
Copy link
Member

@shulcsm have you tested that this is actually the case in visitedCollections. I can't come up with a flow diagram of how this state is actually reached. The property is only set, when you call flush on the EntityManager.

@shulcsm
Copy link
Contributor Author

shulcsm commented Jun 25, 2013

@beberlei
Early return point here https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L315 cause this.

To reproduce:

  1. Select existing entity
  2. Add new associated entities
  3. Remove associated entities
  4. Flush (There are no actual data, so commit returns at L315 without reaching the clear at L381)
  5. Clear
    uow should be empty, visitedCollections are still there.

beberlei added a commit that referenced this pull request Jun 30, 2013
@beberlei beberlei merged commit 29d6da0 into doctrine:master Jun 30, 2013
@shulcsm shulcsm deleted the patch-1 branch June 30, 2013 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants