日記帳
本ページはプロモーションが含まれています
カテゴリー
Links
blog(ブログ)マスター
アンドロイドの巣
ゼロから始めるベランダ菜園
タイトル
ラジコン
2024年5月
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

PHP Fatal error: Out of memory (allocated 49807360) (tried to allocate 2140027 bytes) in phar

2018-06-20 06:31
cygwin
PHP Fatal error: Out of memory (allocated 49807360) (tried to allocate 2140027 bytes) in phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php on line 451

451: $result = zlib_decode($result);

なぜか50MBしか割り当てられていないとエラーが表示されます。

確認するが 512MBきちんと割り当てられている。
php -i | grep memory_limit
memory_limit => 512M => 512M

php -r "\$s = str_repeat(' ', 1000*1000*1000);"
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 1000000024 bytes) in Command line code on line 1

zlib_decode関数が怪しい
ということでzlib_decode関数をいじめてみます。
php -r "\$s = zlib_encode(' ',ZLIB_ENCODING_DEFLATE); str_repeat(\$s, 100*1000*1000);"
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 900000024 bytes) in Command line code on line 1
予想と違う結果で、きちんと設定値が返ってきました。

ということは、
・cygwinのphpにメモリリーク
・phar がメモリを食いつぶしている
・composer がメモリを食いつぶしている
あたりが疑われます

これ以上の追及は時間の無駄(というかわからない)なので
dosプロンプトで実行して解決
curl -O https://getcomposer.org/composer.phar
php composer.phar オプション



ブログ内 関連記事: PHP Fatal error


ブログ内 関連記事: PHP Fatal error

トラックバック
トラックバックはありません。
PR

[PR]