civiCRM API and memory release

I read in one of the bug threads a resolve to fix the memory issue while manipulatig with contacts in civicrm. What it said was to use

CRM_Core_DAO::freeResult( );

This  reset the DB_DO global array so we can reuse the memory. But I am again a doubting guy so what I used to is free or release dao object the very moment the desired task is hadled.

For eg:-

$upt_qry = “UPDATE civicrm_value_user_status_32 SET {$updt_req} ”
.” WHERE user_type_131=\”%s\” AND entity_id=\”%s\” “;
$upt_qry = sprintf($upt_qry,mysql_escape_string($usertapeInfo[‘user_type’]),
mysql_escape_string($crm_contact_id));
$result = CRM_Core_DAO::executeQuery( $upt_qry );
$result->free();

This I found really helpful in scenarios with low memory and iterative cycles. Please share with me your thoughts.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: