Lua pcre inside nginx

Chaos Wang chaoslawful at gmail.com
Thu May 5 07:36:57 MSD 2011


NginX hooked pcre memory alloc/free functions pcre_malloc/free to use 
its memory pool, in order to work around its memory leaking problem. As 
a side effect, it reset this pool to NULL after every usage in core 
without considering possible external references. If you don't set pcre 
memory hooks to your own implementation, you will surely get the error.

ngx_lua has fixed this problem, and can use pcre related extensions 
normally after v0.1.6rc5.

Ref:
* src/core/ngx_regex.c in NginX sources
* ngx_http_lua_patch.c in ngx_lua sources

On 2011年05月05日 03:03, Akins, Brian wrote:
> I wanted to use pcre inside a lua script using rex_pcre.  However, I always
> get the error:
>
> failed to get memory (pattern offset: 15)
>
> The snippet of code always works in a standalone script.
>
> Ideas?
>




More information about the nginx mailing list