PHP允许的内存大小耗尽但尝试分配的内存更少

时间:2018-03-01 19:49:01

标签: php memory upload out-of-memory image-upload

我使用imagecreatefrompng($image)函数收到此错误:

Got error 'PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 61440 bytes) in /var/www/vhosts/SNIPED/httpdocs/app/helper.php on line 115\nPHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 147456 bytes) in /var/www/vhosts/SNIPED/httpdocs/vendor/composer/ClassLoader.php on line 412

不幸的是,我不确定,因为 61440字节允许的1073741824字节更少。我做错了什么?

1 个答案:

答案 0 :(得分:1)

PHP试图分配的字节数是增量的:它要求61440字节,当它被添加到它已经使用的内存时,超过了允许的内存量。