mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Compute the size of pages before allocating memory (#14650)
`start_memory_manager()` calls `zend_mm_init()` via `alloc_globals_ctor()` before setting `REAL_PAGE_SIZE` to the right value. Moving the `REAL_PAGE_SIZE` setting block before the call to `alloc_globals_ctor()` makes the allocator behave properly on systems with a page size different than 4k. Suggested-by: arnaud-lb
This commit is contained in:
parent
3da6377806
commit
e3c9f5a585
1 changed files with 5 additions and 5 deletions
|
@ -3109,11 +3109,6 @@ static void alloc_globals_dtor(zend_alloc_globals *alloc_globals)
|
|||
|
||||
ZEND_API void start_memory_manager(void)
|
||||
{
|
||||
#ifdef ZTS
|
||||
ts_allocate_fast_id(&alloc_globals_id, &alloc_globals_offset, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor);
|
||||
#else
|
||||
alloc_globals_ctor(&alloc_globals);
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
# if defined(_SC_PAGESIZE)
|
||||
REAL_PAGE_SIZE = sysconf(_SC_PAGESIZE);
|
||||
|
@ -3121,6 +3116,11 @@ ZEND_API void start_memory_manager(void)
|
|||
REAL_PAGE_SIZE = sysconf(_SC_PAGE_SIZE);
|
||||
# endif
|
||||
#endif
|
||||
#ifdef ZTS
|
||||
ts_allocate_fast_id(&alloc_globals_id, &alloc_globals_offset, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor);
|
||||
#else
|
||||
alloc_globals_ctor(&alloc_globals);
|
||||
#endif
|
||||
}
|
||||
|
||||
ZEND_API zend_mm_heap *zend_mm_set_heap(zend_mm_heap *new_heap)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue