On 10/10/2014 09:50 AM, Stas Malyshev wrote: > Hi! > >> Can you please elaborate a little ? >> Doesn't such leak have to be fixed in ext/gmp ? > > We clean up the memory at the end of the request. But if the request > ended abnormally and we had some active gmp objects, with gmp data > allocated outside emalloc we could not clean that and it ends up being > persistent memory leak. Also, of course, that also excepts gmp objects > from PHP memory limit, which makes it less useful.
At the same time we can't just switch libgmp to our allocator in MINIT since it gets called by other libraries outside of a PHP request as Remi pointed out via Apache's mod_gnutls. And also from within a PHP request but indirectly via freetds+gnutls where freetds has no idea we have switched the allocator on them. We need to make it more granular. gmp_init() should set it and set a flag and then in RSHUTDOWN we can check that flag and restore the default allocator to take care of the outside-request access, and for inside-request access like the freetds extension, we probably need to explicitly set it back to the default handler in that extension in each call that might call it. Huge PITA to catch all those cases though. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php