Hi, > -----Original Message----- > From: Nikita Popov [mailto:nikita....@gmail.com] > Sent: Monday, March 21, 2016 7:54 PM > To: Anatol Belski <anatol....@belski.net> > Cc: David Zuelke <d...@heroku.com>; Christoph Becker <cmbecke...@gmx.de>; > Pierre Joye <pierre....@gmail.com>; PHP internals <internals@lists.php.net> > Subject: Re: [PHP-DEV] PCRE JIT stack size limit > > The issue I have with more increasing the stack is that - while as we > see > till today > the default stack size of 32K is enough in the common case, the max of > it > will be > reserved. So the real usage will most likely stay under 32K, but the > whole > of max > (say 64K now) will be unusable by anything else. > > > > Are you sure about that? The documentation says "The arguments are a starting > size for the stack, and a maximum size to which it is allowed to grow." Unless > I'm misunderstanding something, it should not be allocating the maximum size > right away. > Regarding PCRE it nearest refers to the point 2 of http://www.pcre.org/original/doc/html/pcrejit.html#SEC9 . The max we pass will turn to a reserved memory region. That means that the address space will be not available for allocations within the same process/thread. Checking the PCRE code, that's exactly what happens. A contiguous memory region gets claimed, but only the start size is being allocated initially.
True is, that the memory usage will stay by the default stack size in the most cases, and currently no issues are seen within the common app usage. But the reserved memory region will keep other parts of the process out from taking the addresses inside it. This can cause negative impacts on other PHP parts which could require some contiguous memory region, or on a general process memory fragmentation. The more PCRE would reserve, the more addresses would be unavailable because of it. Understanding that it is the nature of the PCRE JIT, we should keep our max value of the PCRE JIT stack size as low as possible. Regards Anatol -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php