Update of /cvsroot/audacity/audacity-src/src/blockfile
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv7069/src/blockfile

Modified Files:
        SimpleBlockFile.cpp 
Log Message:
Fix RAM caching on OSX

Index: SimpleBlockFile.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/blockfile/SimpleBlockFile.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- SimpleBlockFile.cpp 9 Oct 2009 14:28:48 -0000       1.31
+++ SimpleBlockFile.cpp 12 Nov 2009 01:15:37 -0000      1.32
@@ -74,6 +74,10 @@
 #include "sndfile.h"
 #include "../Internat.h"
 
+#if defined(__WXMAC__)
+#include <sys/sysctl.h>
+#endif
+
 //#define DEBUG_OUTPUT(s) printf("[SimpleBlockFile] %s\n", s)
 #define DEBUG_OUTPUT(s)
 
@@ -598,8 +602,19 @@
       lowMem = 16;
    }
    lowMem <<= 20;
-    
-   return cacheBlockFiles && (wxGetFreeMemory() > lowMem);
+
+   wxMemorySize avail;
+
+#if defined(__WXMAC__)
+   uint64_t mem = 0;
+   size_t len = sizeof(uint64_t);
+   sysctlbyname("hw.memsize", &mem, &len, NULL, 0);
+   avail = mem;
+#else
+   avail = wxGetFreeMemory();
+#endif
+
+   return cacheBlockFiles && (avail > lowMem);
 }
 
 // Indentation settings for Vim and Emacs and unique identifier for Arch, a


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to