M
Matt Gilarde
Guest
Neither memory-mapped nor non-memory-mapped PL files instantly use up as much memory as the size of the file. The AVM doesn't read the entire non-mapped file into memory when it first accesses it. It only reads the directory (the list of files contained in the library) and then reads the r-code on demand. If you never run any procedures from the library no more memory (other than the memory allocated for the directory) will be used for the library. If you only run half of the procedures you'll only use half of the memory (or less, since the AVM has limits on how much r-code it keeps in memory at once). For mapped libraries the story is similar. The directory is read when the file is first accessed. The operating system will reserve enough memory in the virtual address space to fit the entire file but it won't actually allocate that much memory. Memory will be allocated as the AVM reads r-code from the PL file. The advantage is that this memory is shared between processes so each one doesn't have its own copy. I think you would have to set up a test where all of the code in the library is loaded so you can so a comparison between mapped and non-mapped.
Continue reading...
Continue reading...