lua-users home
lua-l archive

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


It was thus said that the Great Mike McGonagle once stated:
> Hello all,
> 
> I was wondering if anyone could tell me how "memory" efficient Lua is
> for dealing with text processing? I would like to use it as a
> scripting language to do some template generation for another
> programming language. I guess what I am wondering is if Lua only deals
> with "static" strings, is there a point where the amount of memory
> used becomes cumbersome to deal with?

  If your question is "Will I run out of memory processing a lot of strings
in Lua?" the answer is: probably not.  I have a long-running process [1]
that does text processing and it's amazingly stable memory wise:

VSZ   RSZ START CMD
1868  904 Oct30 /usr/local/sbin/syslogintr

(VSZ is the overall memory usage in kilobytes; RSZ is what's currently not
swapped out, in kilobytes).  

> I guess I am wondering if there is a way, like in Java, to create a
> "StringBuffer" object in lua, so that all these strings do not live
> permanently in memory.

  Lua is garbage collected---as long as you drop references to strings that
are no longer needed, the memory will be reclaimed.

  -spc 

[1]	My syslogd replacement that uses Lua:

	http://www.conman.org/software/syslogintr/