Cygwin PHP (all available versions) has a hard 4MB memory limit

Ken Brown kbrown@cornell.edu
Sun Jul 19 02:11:01 GMT 2020


On 7/17/2020 5:39 PM, km2z7kca0oge--- via Cygwin wrote:
> Hi there,
> 
> Recently I've noticed that PHP seems have to hard 4MB memory limit,

[...]

> Example script:
> ```
> <?php
> 
> echo ini_get('memory_limit'), "\n";
> 
> file_get_contents('http://mirror.cwcs.co.uk/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-dvd1.iso'); // A large file such as an ISO.
> ```
> 
> Output:
> $ php test.php
> 128M
> PHP Fatal error:  Out of memory (allocated 4194304) (tried to allocate 2097184 bytes) in /c/Users/JackBlower/tmp-safe/test.php on line 5

Thanks for the simple reproduction steps.  I've run this under gdb, and the 
function zend_mm_alloc_huge, which tries to get a chunk of memory from the 
system, seems to be failing when it tries to increase the zend heap from 4MB to 
6MB.  I'm in the process of building an unoptimized version of php to make 
debugging easier, in the hope of figuring out why the function is failing.

Ken


More information about the Cygwin mailing list