lua-users home
lua-l archive

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




Andrew Starks <andrew.starks@trms.com>于2015年8月20日周四 上午12:22写道:
Did you just re-introduce near and far pointers? :)

My fault. forget slice, as Philipp Janda said in early post, it's only an user-defined tag.

A mechanism to efficiently and safely traverse a C structure inside of
Lua, without needing to manually create the necessary book keeping
code that is required to handle garbage collection and also "which
object does this field belong to?"

Right :)

Let me try to explain one of real user case.

In my MMO game server, I create about 10K lua vm in one process. The average size of them is about  10M. (So it needs more than 100G altogether, I run it on a 128G RAM server) They works together like erlang's processes.

We have a large tree based document read from a large xml or json file. About 10M size and more than 100K records. It's immutable and shared among all of the lua vm.

We can't load this document in each lua vm because of size (And parsing time of the document is also a problem), so I must use a C object to store this document, and share the pointer.

My problem is how to traverse this C object as lua tables efficiently.