Skip to content
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

Memory Issues #43

Closed
angelcoding opened this issue Sep 30, 2014 · 8 comments
Closed

Memory Issues #43

angelcoding opened this issue Sep 30, 2014 · 8 comments

Comments

@angelcoding
Copy link

This is actually an issue when using Yii2 but I believe it is directly related to this plugin so thought I'd post here first...

I'm trying to use a bower package in my composer.json but just keep getting fatal PHP memory exhaustion errors.

As a quick isolated test I created a new Yii2 Advanced App project using php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced advanced and ran composer update.

That worked fine.

I then added "bower-asset/angular-bootstrap": "dev-master" to the require section of composer.json and ran composer update again.
PHP very quickly started eating up memory after composer ran through all the different versions and eventually died with the Fatal memory exhaustion error.

I can temporarily get around this by upping the memory limit, but as soon as I add other packages into the mix the memory requirements keep going up and up.
I tried using a specific version number (rather than dev-master) but that didn't help either.

Is there something I'm doing wrong?
Is there a workaround?
Is there a problem with that specific bower package?
Or does the asset plugin/composer simply need some memory performance improvements?

I'm fairly new to package management, especially Bower, so apologies if the answer is an obvious one.

@cebe
Copy link
Contributor

cebe commented Sep 30, 2014

How high is the limit you hit with angular-bootstrap?

@francoispluchino
Copy link
Member

The plugin only creates VCS repositories automatically, and converted the bower.json or package.json files into a Composer version. You get almost the same memory consumption if you added all the repositories manually (but they must contain the file composer.json, this is not necessary with the plugin).

The problem of excessive memory consumption by Composer is well known (see composer/composer#3208, composer/composer#2959, composer/composer#2704, composer/composer#2661, composer/composer#1898).

I suggest you increase the memory size in your php.ini (personally, I have memory_limit = 256M).

Concerning the performance (getting content of packages), I suggest you read the issue #42.

@angelcoding
Copy link
Author

Thanks for the quick replies.

I've tried temporarily increasing memory by using php -dmemory_limit=1G /usr/bin/composer.phar update but it still dies at 1GB. Not much point trying any higher than that, especially as I'm only dealing with one package with many more to come.

Looks like it's a question of finding workarounds and ways to minimize the load on the composer solver then.

Unfortunately I don't have time to look into it further at the moment, so back to manual downloads for me (certainly for larger packages).

Thanks again.

@francoispluchino
Copy link
Member

I just tested, and I have never exceeded 41,2M for memory.

However, for the update, Composer analyzes all versions, and there is no workaround.

I grant you, angular/bower-angular is very very very slow, because it has 1 683 tags, and this is just huge!

@francoispluchino
Copy link
Member

@angelcoding, @cebe I have maybe a solution (see #44).

@angelcoding
Copy link
Author

@francoispluchino Strange, maybe there's something unique to my setup causing the memory leak then.
Thanks for the info and possible solution. Will try it out when I get a chance.

@francoispluchino
Copy link
Member

@francoispluchino
Copy link
Member

The issue #52 reduces the amount of memory used for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants