Skip to content

Commit 1aafed5

Browse files
committed
Remove zend_set_memory_limit_ex() API
This was added temporarily for the PHP-8.0 branch to avoid an ABI break.
1 parent b4559e7 commit 1aafed5

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

Zend/zend_alloc.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,7 +2658,7 @@ ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length)
26582658
return p;
26592659
}
26602660

2661-
ZEND_API zend_result zend_set_memory_limit_ex(size_t memory_limit)
2661+
ZEND_API zend_result zend_set_memory_limit(size_t memory_limit)
26622662
{
26632663
#if ZEND_MM_LIMIT
26642664
if (memory_limit < ZEND_MM_CHUNK_SIZE) {
@@ -2672,13 +2672,6 @@ ZEND_API zend_result zend_set_memory_limit_ex(size_t memory_limit)
26722672
return SUCCESS;
26732673
}
26742674

2675-
ZEND_API void zend_set_memory_limit(size_t memory_limit)
2676-
{
2677-
#if ZEND_MM_LIMIT
2678-
AG(mm_heap)->limit = memory_limit >= ZEND_MM_CHUNK_SIZE ? memory_limit : ZEND_MM_CHUNK_SIZE;
2679-
#endif
2680-
}
2681-
26822675
ZEND_API size_t zend_memory_usage(bool real_usage)
26832676
{
26842677
#if ZEND_MM_STAT

Zend/zend_alloc.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ ZEND_API void * __zend_realloc(void *p, size_t len) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
219219
#define perealloc2_recoverable_rel(ptr, size, copy_size, persistent) ((persistent)?realloc((ptr), (size)):erealloc2_recoverable_rel((ptr), (size), (copy_size)))
220220
#define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s))
221221

222-
ZEND_API void zend_set_memory_limit(size_t memory_limit);
223-
ZEND_API zend_result zend_set_memory_limit_ex(size_t memory_limit);
222+
ZEND_API zend_result zend_set_memory_limit(size_t memory_limit);
224223

225224
ZEND_API void start_memory_manager(void);
226225
ZEND_API void shutdown_memory_manager(bool silent, bool full_shutdown);

main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static PHP_INI_MH(OnChangeMemoryLimit)
272272
} else {
273273
value = Z_L(1)<<30; /* effectively, no limit */
274274
}
275-
if (zend_set_memory_limit_ex(value) == FAILURE) {
275+
if (zend_set_memory_limit(value) == FAILURE) {
276276
zend_error(E_WARNING, "Failed to set memory limit to %zd bytes (Current memory usage is %zd bytes)", value, zend_memory_usage(true));
277277
return FAILURE;
278278
}

0 commit comments

Comments
 (0)