]> git.sesse.net Git - vlc/commitdiff
mmap: open with MAP_NOCACHE
authorDerk-Jan Hartman <hartman@videolan.org>
Fri, 10 Oct 2008 12:02:59 +0000 (14:02 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Fri, 10 Oct 2008 12:02:59 +0000 (14:02 +0200)
This means that when the machine gets low on memory, this mmap'ed 4GB movie file is the first to be thrown out of the memory again.

modules/access/mmap.c

index b9eadcaa06354bc332875537fa0b57d98c945502..a5aefd451aa23479d0c7935232b9baac0242cf61 100644 (file)
@@ -136,7 +136,7 @@ static int Open (vlc_object_t *p_this)
     /* Autodetect mmap() support */
     if (st.st_size > 0)
     {
-        void *addr = mmap (NULL, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
+        void *addr = mmap (NULL, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE | MAP_NOCACHE, fd, 0);
         if (addr != MAP_FAILED)
             munmap (addr, 1);
         else