Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.20
-
Fix Version/s: 4.7.23
-
Component/s: CiviCRM API
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Contributed Code
-
Verified?:No
Description
There's a significant memory leak in the API that primarily manifests during CSV CLI import (bin/csv/import.php) - e.g. it leaks about 60MB for every 1000 contact records imported. This makes large imports impractical.
The leak is cleared by unsetting the globals used by the PEAR_DB_DATAOBJECT cache.
To reproduce:
Add this line to <civiroot>/bin/class.cli.php after line 432 ($this->row++)
echo 'Memory usage: ' . memory_get_usage(TRUE) / 1048576 . PHP_EOL;
Then attempt to import a large number of contacts.
php csv/import.php -e Contact --file /path/to/contacts.csv
The solution is to unset the globals every so many API calls. PR incoming.