Skip to content

Commit 7740eda

Browse files
remicolletsmalyshev
authored andcommitted
Fix bug #63595 GMP memory management conflicts with other libraries using GMP
Drop use of php memory allocators as this raise various conflicts with other extensions and libraries which use libgmp. No other solution found. We cannot for ensure correct use of allocator with shared lib. Some memory can allocated before php init Some memory can be freed after php shutdown Known broken run cases - php + curl + gnutls + gmp - mod_gnutls + mod_php + gnutls + gmp - php + freetds + gnutls + gmp - php + odbc + freetds + gnutls + gmp - php + php-mapi (zarafa) + gnutls + gmp
1 parent c351b47 commit 7740eda

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

ext/gmp/gmp.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -324,30 +324,6 @@ static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
324324
# define MAX_BASE 36
325325
#endif
326326

327-
/* {{{ gmp_emalloc
328-
*/
329-
static void *gmp_emalloc(size_t size)
330-
{
331-
return emalloc(size);
332-
}
333-
/* }}} */
334-
335-
/* {{{ gmp_erealloc
336-
*/
337-
static void *gmp_erealloc(void *ptr, size_t old_size, size_t new_size)
338-
{
339-
return erealloc(ptr, new_size);
340-
}
341-
/* }}} */
342-
343-
/* {{{ gmp_efree
344-
*/
345-
static void gmp_efree(void *ptr, size_t size)
346-
{
347-
efree(ptr);
348-
}
349-
/* }}} */
350-
351327
/* {{{ ZEND_GINIT_FUNCTION
352328
*/
353329
static ZEND_GINIT_FUNCTION(gmp)
@@ -369,8 +345,6 @@ ZEND_MODULE_STARTUP_D(gmp)
369345
#endif
370346
REGISTER_STRING_CONSTANT("GMP_VERSION", (char *)gmp_version, CONST_CS | CONST_PERSISTENT);
371347

372-
mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
373-
374348
return SUCCESS;
375349
}
376350
/* }}} */

0 commit comments

Comments
 (0)