
144
CHAPTER 5 MEMORY MANAGEMENT, MEMORY-MAPPED FILES, AND DLLS
memory, and write it. Such a solution, included on the book’s Web site, would be as
effectiv e as Program 5 –4 and is often faster, as shown in Appendix C.
Based Pointers
File maps are convenient, as the preceding examples demonstrate. Suppose, how-
ever, that the program creates a data structure with pointers in a mapped file and
expects to access tha t file in the future. Pointers will all be relative to the virtual
address returned from
, and they will be meaningless when
mapping the file the next time. The solution is to use based pointers, which are
actually offsets relative to another ...