On Thu, 23 May 2002 22:39:01 +1000 "Brett Nash" <nash nash nu> wrote:
But is this an issue at all? how does Linux/FreeBSD/etc work with executables? will code with inline pixmaps be discarded from memory after loading or not? and if so, is it important to make it one big block with inline images and how do I do so?The unused pixmap will be paged out by the VM system eventually. However since the OS doesn't know what you are going to do with it will have to write them to the swap partition[1] so it can read it back in if you touch it again. To allow it to page them as well as possible they should not be on pages with other (non-init) data - hence a big block would be best - preferably first in the data segment if you can.
would compiling them all into one objectfile create such a big block? and is it possible to tell the linker to put that block in front?
Hence there is an explicit (and expensive) cost in terms of swap space usage and disk bandwidth (and even worse - possibly latency) for your pixmaps if they are paged out. Personally I would recommend you load them specifically using open()/read() or mmap(). This means as soon as you are finished you can munmap or close and allow the OS to just free the pages. I would probably lean towards mmap in this case, but then again I use mmap() for nearly everything :-) Additionally mmap will appear exactly the same as data compiled in.
but how does one get the entry points to the different pixmaps after mmap'ing a compiled block of inline images? How should I do this, I know how to create a .c file from the images, and I can compile that into an objectfile. How to proceed to make it useful for mmap'ing them? regards, Olivier
Attachment:
pgp9tkWhIoEhq.pgp
Description: PGP signature