Skip to content
Snippets Groups Projects
Commit 3e8437f3 authored by eileen's avatar eileen
Browse files

#2073 Fix a real live leak

I used the same methods I had been playing with on the test class on a contribution
import script and found that the object that was increasing in memory in tandem with
me increasing iterations was an instance of DB_result

I tracked it down to here. In essence our main DAO functions clean up after themselves - e.g
when the DAO is destructed it cleans up the globals it has created.

However, this older ->query() function does not do that and each time is is called increases it's memory hold.

It's also worth better caching in this function...
parent 4fc8726b
No related branches found
No related tags found
No related merge requests found
......@@ -204,8 +204,6 @@ SELECT acl.*
protected static function getGroupACLRoles($contact_id) {
$contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
$rule = new CRM_ACL_BAO_ACL();
$query = " SELECT acl.*
FROM civicrm_acl acl
INNER JOIN civicrm_option_group og
......@@ -228,7 +226,7 @@ SELECT acl.*
$results = [];
$rule->query($query);
$rule = CRM_Core_DAO::executeQuery($query);
while ($rule->fetch()) {
$results[$rule->id] = $rule->toArray();
......@@ -249,7 +247,7 @@ SELECT acl.*
AND acl.entity_table = 'civicrm_acl_role'
";
$rule->query($query);
$rule = CRM_Core_DAO::executeQuery($query);
while ($rule->fetch()) {
$results[$rule->id] = $rule->toArray();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment