Re: [PATCH] fix pcre global variable abuse
| From: | Rasmus Lerdorf | Date: | Fri, 23 Apr 2004 17:41:34 +0000 |
| Subject: | Re: [PATCH] fix pcre global variable abuse | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9522@lists.php.net to get a copy of this message | ||
On Fri, 23 Apr 2004, Andrei Zmievski wrote:
> On Fri, 23 Apr 2004, Rasmus Lerdorf wrote:
> > You mean they are not generic memory alloc functions? I know that. But
> > they map to malloc/free which is the important point here.
>
> The global variables pcre_malloc and pcre_free initially
> contain the entry points of the standard malloc() and free()
> functions respectively. PCRE calls the memory management
> functions via these variables, so a calling program can
> replace them if it wishes to intercept the calls. This
> should be done before calling any PCRE functions.
>
> pcre_malloc() is then called at various points to obtain additional
> memory.
Right, sorry, more precisely, by setting them to pemalloc/pefree they
result in calling malloc/free anyway. Not a direct mapping of course.
But I think we have beaten this one to death. Since PHP just calls
malloc/free anyway and the wrapper layer is causing problems, simply
removing the php layer is the obvious answer.
-Rasmus