Re: [PHP4BETA] global malloc/free replacements
| From: | Zeev Suraski | Date: | Fri, 26 Nov 1999 13:42:34 +0000 |
| Subject: | Re: [PHP4BETA] global malloc/free replacements | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6925@lists.php.net to get a copy of this message | ||
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();).
Zeev
On Fri, 26 Nov 1999, Sascha Schumann wrote:
> Hi,
>
> we need to find a way to replace malloc/free calls globally
> (everywhere, also in libzend/TSRM).
>
> These must be replaced, because the allocator functions on
> most systems are not reentrant. They use a static data
> structure to determine the free blocks.
>
> Therefore, all mallocs/frees must go through exactly one set
> of functions which must be mutexed. It would be enough, if we
> could define the replacement functions in one place (one
> header file), but I am not sure where that place would be.
> The SAPI modules must determine which replacement functions
> to use (threaded web-servers provide these usually), but I
> don't think libzend/TSRM include anything from the PHP side.
>
> What we could do is to pass a prefix to libzend/TSRM at
> configure time which would be the prefix of the replacement
> functions.
>
> Any ideas?
>
> --
>
> Regards,
>
> Sascha Schumann
> Consultant
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>
--
-----------------------------------------------------
Zeev Suraski <zeev@zend.com> http://www.zend.com/