[vlc-devel] commit: mmap: open with MAP_NOCACHE (Derk-Jan Hartman )

git version control git at videolan.org
Fri Oct 10 14:04:06 CEST 2008


vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Fri Oct 10 14:02:59 2008 +0200| [cbc1122ac4551505181ea048ca14a5f87041090f] | committer: Derk-Jan Hartman 

mmap: open with MAP_NOCACHE

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cbc1122ac4551505181ea048ca14a5f87041090f
---

 modules/access/mmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/access/mmap.c b/modules/access/mmap.c
index b9eadca..a5aefd4 100644
--- a/modules/access/mmap.c
+++ b/modules/access/mmap.c
@@ -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




More information about the vlc-devel mailing list