Re: [PHP4BETA] global malloc/free replacements

From: Date: Fri, 26 Nov 1999 15:42:27 +0000
Subject: Re: [PHP4BETA] global malloc/free replacements
References: 1 2  Groups: php.version4 
Request: Send a blank email to php-version4+get-6931@lists.php.net to get a copy of this message
On Fri, Nov 26, 1999 at 03:42:34PM +0200, Zeev Suraski wrote: > The location for this should definitely be TSRM. TSRM knows nothing about > Zend, and definitely nothing about PHP, while both Zend and PHP know TSRM > very well. > > I think the best way would be to let TSRM define ts_malloc(), ts_free() > and ts_realloc(), that Zend/PHP would use. On systems where malloc() and > friends are reentrant, these can be simple #define's, and on other > systems, they'd point to the corresponding wrapper function that's thread > safe (since we already have mutexes in TSRM, we can have a generalized > ts_malloc() for all platforms that would be more or less lock(); malloc(); > unlock();). > Before we go into greater detail, let me do some research. Basically, the GNU C library manual says under ``Nonreentrancy''* that malloc/free etc. are non-reentrant. But then Unix98 says indirectly that these functions are thread-safe. Possible conclusion: Operating systems which do not have thread support, may have reentrancy problems with malloc/free. Since ZTS won't work on these operating systems, we do not need to care. * the section is about signal handlers, but most of the things mentioned there apply to threads as well -- Regards, Sascha Schumann Consultant

« previous php.version4 (#6931) next »