lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 9 January 2013, someone asked me:
Hi,
out of curiosity, why did you change rlexlib to use Lua's allocator?  I tried finding any comments/notes explaining why, in the change notes and on the mailing list, but couldn't find it.

[Although this question was not asked on lua-l, I thought it would be good to send a reply there.]

lrexlib 2.7.x uses, where possible, the Lua state's allocator, rather than malloc. This is done because it seems to me this is what one would expect: if one chooses a different allocator for one's Lua state, e.g. for debugging or performance reasons, then it should be used for everything.

Unfortunately, it's not possible to use it for absolutely everything, because some memory is allocated and/or freed by a given regex library.

I notice now that PCRE allows its allocator functions to be overridden, so I shall do that; unfortunately, GNU, POSIX, oniguruma and TRE all don't.