lua-users home
lua-l archive

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

Jakub Jirutka <>于2018年7月5日周四 下午7:09写道:

On 05/07/18 12:53, 云风 Cloud Wu wrote:
> Our game server use more than 100GiB RAM in lua  (But separate into
> thousands lua vm in one  process)

Okay, my bad, I should be more specific. What matters here is how much
memory is allocated for single Lua heap, not how much memory consumes
some program that embeds Lua.

I know some other game server projects use more than 10GB RAM in one lua vm, and the cost of gc is always a trouble. Someone choose python instead of lua because python can use reference count only (turn off mark-sweep gc) to manage life time of objects. 

My opinion is using multiple lua vm and keeping each lua vm small is a better way. Lua can do it simpler than other dynamic language such as python, _javascript_, etc. Sometimes, we use a few vm to store large data. These vm consume a lot of memory, but not mutable. We don't need mark these objects constantly.

Even for small vm, lua 5.4's gc is very valuable because the total memory of thousands lua vm can be very large.