[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using Lua for config files
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 18 Mar 2014 09:25:22 +0200
On Mon, Mar 17, 2014 at 9:41 PM, Rena <hyperhacker@gmail.com> wrote:
> s = ('xxxxxxxxxxxxxxxx'):rep(99999999):rep(99999999):rep(99999999)
>
> This not only consumes a lot of memory, but because nearly all of the time
> is spent in string.rep, debug hooks won't be called either (the entire
> function call is a single Lua operation)
This is why it's useful to disable the string metatable temporarily.
See the 'paranoid' mode of pretty.load:
https://github.com/stevedonovan/Penlight/blob/master/lua/pl/pretty.lua#L72
(note also the ugly and rather slow lexical scan needed to weed out
loop constructs - hence the data mode patch)