-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Comment GC disable and enable GC after run #3503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,7 @@ public function __construct(IOInterface $io, Config $config, RootPackageInterfac | |
*/ | ||
public function run() | ||
{ | ||
// Disable garbage collection to save memory and time | ||
gc_collect_cycles(); | ||
gc_disable(); | ||
|
||
|
@@ -336,6 +337,8 @@ public function run() | |
} | ||
} | ||
|
||
gc_enable(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this triggers a warning on HHVM for some configurations, so this should be handled There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which kind of warning ? is it something that can be handled by wrapping it in a "if not hhvm" ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes it can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, i've quickly check and it can be done with
(dunno if it helps) |
||
|
||
return 0; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not saving memory. It is about saving time because the GC will be triggered many times (because of the amount of Zval used in the solver for the package graph) for cases where it cannot collect anything (the refcount will take care of all the package graph objects btw)