Re: executable size thoughts



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.

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.

As for any other initialisation data - unless it is greater then a few
pages (remember x86s still have a stone age 4k page) don't worry about
it.

        Regards,
        nash

[1] Some OSes page to the binary avoiding this problem (in this case).
This is not necessarily a good thing.


-- 
Brett Nash <nash nash nu>
Sometimes it's better to light a flamethrower than curse the darkness.



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