Ticket #1276 (closed enhancement: fixed)
Memory leaks suggestion
| Reported by: | colnector | Owned by: | romanb |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.1.0-ALPHA1 |
| Component: | Query/Hydration | Version: | 1.0.2 |
| Severity: | Keywords: | ||
| Cc: | Has Test: | no | |
| Status: | Pending Core Response | Has Patch: | no |
Description
Currently, free() method of DoctrineQuery? needs to be used to prevent some of the memory leaks, I find the syntax inconvenient . I suggest to replace this syntax
$q = Doctrine_Query::create()
->from($classname.' c')
->leftJoin('c.Translation t INDEXBY t.lang')
->where('t.lang = ? AND t.name = ? '.$sAddWhere, array($lang, $name));
$existing = $q->fetchOne(array(), Doctrine::HYDRATE_ARRAY);
$q->free(true);
to the following:
$existing = Doctrine_Query::create()
->from($classname.' c')
->leftJoin('c.Translation t INDEXBY t.lang')
->where('t.lang = ? AND t.name = ? '.$sAddWhere, array($lang, $name))
->fetchOne(array(), Doctrine::HYDRATE_ARRAY_FREE);
Using the parameter HYDRATE_ARRAY_FREE would mean free() is called after hydration and thus the syntax stays clearer. Other options to solved this issue could be another parameter to the execute() method or a global setting for Doctrine.
Change History
Note: See
TracTickets for help on using
tickets.