mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
commit
b4559e7ae4
4 changed files with 32 additions and 4 deletions
|
@ -2658,11 +2658,24 @@ ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length)
|
|||
return p;
|
||||
}
|
||||
|
||||
ZEND_API zend_result zend_set_memory_limit_ex(size_t memory_limit)
|
||||
{
|
||||
#if ZEND_MM_LIMIT
|
||||
if (memory_limit < ZEND_MM_CHUNK_SIZE) {
|
||||
memory_limit = ZEND_MM_CHUNK_SIZE;
|
||||
}
|
||||
if (UNEXPECTED(memory_limit < AG(mm_heap)->real_size)) {
|
||||
return FAILURE;
|
||||
}
|
||||
AG(mm_heap)->limit = memory_limit;
|
||||
#endif
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZEND_API void zend_set_memory_limit(size_t memory_limit)
|
||||
{
|
||||
#if ZEND_MM_LIMIT
|
||||
AG(mm_heap)->limit = (memory_limit >= ZEND_MM_CHUNK_SIZE) ? memory_limit : ZEND_MM_CHUNK_SIZE;
|
||||
AG(mm_heap)->limit = memory_limit >= ZEND_MM_CHUNK_SIZE ? memory_limit : ZEND_MM_CHUNK_SIZE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue