1
0
Fork 0

Restore GC and add comments to clarify why we turn it off, fixes #3488, closes #3503

pull/4207/merge
Jordi Boggiano 2016-02-29 15:04:39 +00:00
parent 0ed5b541a9
commit c2d78e5ce0
1 changed files with 9 additions and 0 deletions

View File

@ -163,6 +163,10 @@ class Installer
*/
public function run()
{
// Disable GC to save CPU cycles, as the dependency solver can create hundreds of thousands
// of PHP objects, the GC can spend quite some time walking the tree of references looking
// for stuff to collect while there is nothing to collect. This slows things down dramatically
// and turning it off results in much better performance. Do not try this at home however.
gc_collect_cycles();
gc_disable();
@ -341,6 +345,11 @@ class Installer
}
}
// re-enable GC except on HHVM which triggers a warning here
if (!defined('HHVM_VERSION')) {
gc_enable();
}
return 0;
}