[SDL] [OT] Sound and Music

Tyler Montbriand tsm at accesscomm.ca
Sun Sep 18 19:58:07 PDT 2005

On September 18, 2005 07:12 pm, Marian Schedenig wrote:
> > If you want to get fancy, you can "map" the file into to memory, to have
> > the OS automatically load the appropriate bits as needed;  but not
> > everything can do this.
> That doesn't sound very portable?
It's about as portable as portable gets under UNIXes.  mmap originated in BSD 
and now almost everything has it.  Even Windows has something like it 95 and 
CE included.  I doubt things like Palm and Playstation support it.

I've been toying with making an SDL_mmap library to make it portable-r, 
because I think memory mapping is very elegant;  you get the simplicity of 
loading the whole 50 megs into memory(not even kidding, I've seen lots of 
things do that) without the huge memory waste.  The OS decides which bits 
float in memory, and doesn't have to swap any of it to disk to get rid of it 
-- it's already on disk!  You can even warn the OS you're going to use the 
memory sequentially, so it doesn't pollute the cache with stuff that's only 
needed once every music loop.

More information about the SDL mailing list