[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Reducing Lua memory footprint - need help
- From: "Bogdan Marinescu" <bogdan.marinescu@...>
- Date: Mon, 13 Oct 2008 12:36:18 +0300
You're right, I was considering this too, and it would probably be a
good compromise. And obviously easier than implementing a completely
new data type, though I might implement it both ways as an exercise,
to see the differences (it seems that implementing a new "light
userdata"-like data type won't be that hard after all). I'd still need
one userdata per "virtual module", but that's better than having one
_table_ per "virtual module". My new datatype would need just a
pointer per "virtual module", but I'd go with a standard solution if
the memory savings aren't that important (and they probably aren't).
Thanks,
Bogdan
>
> Why don't you use userdata as modules ? IIRC modules don't have to be
> tables. Your userdata would be zero-sized (or eventually have a simple
> pointer to read-only memory), and could share a single metatable,
> since the userdata itself would be passed as first argument of __index
> to let you determine which module is currently indexed.