8000 Comment GC disable and enable GC after run by Z1ni · Pull Request #3503 · composer/composer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Composer/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public function __construct(IOInterface $io, Config $config, RootPackageInterfac
*/
public function run()
{
// Disable garbage collection to save memory and time
Copy link
Contributor

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)

gc_collect_cycles();
gc_disable();

Expand Down Expand Up @@ -336,6 +337,8 @@ public function run()
}
}

gc_enable();
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Choose a reason for hiding this comment

The 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" ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it can

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i've quickly check and it can be done with

if (defined('HHVM_VERSION')) {
    // Code
}

(dunno if it helps)


return 0;
}

Expand Down
0