[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Embedding Lua files into libraries
- From: KHMan <keinhong@...>
- Date: Tue, 06 Dec 2011 01:00:54 +0800
On 12/6/2011 12:52 AM, Patrick Rapin wrote:
It will double the memory footprint however. Unless you unmap the
compressed source after you uncompressed it. If declared constant an
in its own memory page the Linux kernel will unload it after a while,
when not used and it needs memory. (since it can always reload it
again from disc binary)
I don't see why it should take more memory. After having loaded into
Lua, you can of course deallocate the buffer.
And it is even not necessary to uncompress the whole file in one
phase. You can do it a small buffer at a time, and use lua_load.
Of course, I am not saying this is the optimal solution if your
embedded code has tons of megabytes.
PS: I forget to mention that my build tool removes the comments before
compressing the sources.
If it's available on the 'net for sharing, please update this page
for the benefit of the community:
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia