projects
/
civicrm-core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
90fe910
)
CRM-20754 - Clear memory leak in CSV CLI import
author
Jon goldberg
<jon@palantetech.coop>
Wed, 21 Jun 2017 14:07:31 +0000
(10:07 -0400)
committer
Jon goldberg
<jon@palantetech.coop>
Wed, 21 Jun 2017 14:07:31 +0000
(10:07 -0400)
bin/cli.class.php
patch
|
blob
|
blame
|
history
diff --git
a/bin/cli.class.php
b/bin/cli.class.php
index dbcc5e9caf01268e28dc77b6e38b980b31863dbb..f450b74b51d093253e2ba7409fa823e216c9f4d5 100644
(file)
--- a/
bin/cli.class.php
+++ b/
bin/cli.class.php
@@
-430,6
+430,14
@@
class civicrm_cli_csv_file extends civicrm_cli {
continue;
}
$this->row++;
+ if ($this->row % 1000 == 0) {
+ // Reset PEAR_DB_DATAOBJECT cache to prevent memory leak
+ $GLOBALS['_DB_DATAOBJECT']['RESULTS'] = array();
+ $GLOBALS['_DB_DATAOBJECT']['RESULTSEQ'] = 1;
+ $GLOBALS['_DB_DATAOBJECT']['RESULTFIELDS'] = array();
+ // Forces garbage collection
+ memory_get_usage(true);
+ }
$params = $this->convertLine($data);
$this->processLine($params);
}