Update of /cvsroot/audacity/audacity-src/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23232/src
Modified Files: DirManager.cpp DirManager.h Log Message: Actually make the memory check work this time around. Index: DirManager.h =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/DirManager.h,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- DirManager.h 9 Oct 2009 14:28:48 -0000 1.39 +++ DirManager.h 12 Nov 2009 03:54:26 -0000 1.40 @@ -28,6 +28,8 @@ WX_DECLARE_HASH_MAP(int, int, wxIntegerHash, wxIntegerEqual, DirHash); WX_DECLARE_HASH_MAP(wxString,BlockFile *,wxStringHash,wxStringEqual,BlockHash); +wxMemorySize GetFreeMemory(); + class DirManager: public XMLTagHandler { public: Index: DirManager.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/DirManager.cpp,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- DirManager.cpp 11 Oct 2009 14:55:46 -0000 1.92 +++ DirManager.cpp 12 Nov 2009 03:54:26 -0000 1.93 @@ -78,6 +78,12 @@ #include "prefs/PrefsDialog.h" #include "ondemand/ODManager.h" + +#if defined(__WXMAC__) +#include <mach/mach.h> +#include <mach/vm_statistics.h> +#endif + // Static class variables int DirManager::numDirManagers = 0; @@ -1646,7 +1652,7 @@ while (i != blockFileHash.end()) { BlockFile *b = i->second; - if (b->GetNeedFillCache() && (wxGetFreeMemory() > lowMem)) { + if (b->GetNeedFillCache() && (GetFreeMemory() > lowMem)) { b->FillCache(); } @@ -1692,6 +1698,27 @@ } } +wxMemorySize GetFreeMemory() +{ + wxMemorySize avail; + +#if defined(__WXMAC__) + mach_port_t port = mach_host_self(); + mach_msg_type_number_t cnt = HOST_VM_INFO_COUNT; + vm_statistics_data_t stats; + vm_size_t pagesize = 0; + + memset(&stats, 0, sizeof(stats)); + + host_page_size(port, &pagesize); + host_statistics(port, HOST_VM_INFO, (host_info_t) &stats, &cnt); + avail = stats.free_count * pagesize; +#else + avail = wxGetFreeMemory(); +#endif + + return avail; +} // Indentation settings for Vim and Emacs and unique identifier for Arch, a // version control system. Please do not modify past this point. ------------------------------------------------------------------------------ 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