[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Embedding Lua files into libraries
- From: Patrick Rapin <toupie300@...>
- Date: Mon, 5 Dec 2011 17:52:38 +0100
> 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.