implemented wxGetFreeMemory() under IRIX (patch 1360356); made wxMemorySize always 64 bit as it can overflow even in 32 bit builds otherwise
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36250 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -52,16 +52,13 @@ class WXDLLIMPEXP_CORE wxPoint;
|
|||||||
#define wxMax(a,b) (((a) > (b)) ? (a) : (b))
|
#define wxMax(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
#define wxMin(a,b) (((a) < (b)) ? (a) : (b))
|
#define wxMin(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
|
|
||||||
// wxGetFreeMemory can return huge amount of memory on 64-bit platforms
|
// wxGetFreeMemory can return huge amount of memory on 32-bit platforms as well
|
||||||
// define wxMemorySize according to the type which best fits your platform
|
// so to always use long long for its result type on all platforms which
|
||||||
#if wxUSE_LONGLONG && defined(__WIN64__)
|
// support it
|
||||||
// 64 bit Windowses have sizeof(long) only 32 bit long
|
#if wxUSE_LONGLONG
|
||||||
// we need to use wxLongLong to express memory sizes
|
typedef wxLongLong wxMemorySize;
|
||||||
#define wxMemorySize wxLongLong
|
|
||||||
#else
|
#else
|
||||||
// 64 bit UNIX has sizeof(long) = 64
|
typedef long wxMemorySize;
|
||||||
// assume 32 bit platforms cannnot return more than 32bits of
|
|
||||||
#define wxMemorySize long
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -124,6 +124,12 @@
|
|||||||
#include <sys/utsname.h> // for uname()
|
#include <sys/utsname.h> // for uname()
|
||||||
#endif // HAVE_UNAME
|
#endif // HAVE_UNAME
|
||||||
|
|
||||||
|
// Used by wxGetFreeMemory().
|
||||||
|
#ifdef __SGI__
|
||||||
|
#include <sys/sysmp.h>
|
||||||
|
#include <sys/sysinfo.h> // for SAGET and MINFO structures
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// conditional compilation
|
// conditional compilation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -910,6 +916,10 @@ wxMemorySize wxGetFreeMemory()
|
|||||||
}
|
}
|
||||||
#elif defined(__SUN__) && defined(_SC_AVPHYS_PAGES)
|
#elif defined(__SUN__) && defined(_SC_AVPHYS_PAGES)
|
||||||
return (wxMemorySize)(sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PAGESIZE));
|
return (wxMemorySize)(sysconf(_SC_AVPHYS_PAGES)*sysconf(_SC_PAGESIZE));
|
||||||
|
#elif defined(__SGI__)
|
||||||
|
struct rminfo realmem;
|
||||||
|
if ( sysmp(MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0 )
|
||||||
|
return ((wxMemorySize)realmem.physmem * sysconf(_SC_PAGESIZE));
|
||||||
//#elif defined(__FREEBSD__) -- might use sysctl() to find it out, probably
|
//#elif defined(__FREEBSD__) -- might use sysctl() to find it out, probably
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user