Some applications call GlobalMemoryStatus() very often. Cache the
results of the call for 1 second (spotted by Corel).

diff --git a/memory/global.c b/memory/global.c
index 5cecdf4..302a7e1 100644
--- a/memory/global.c
+++ b/memory/global.c
@@ -7,6 +7,7 @@
 
 #include <sys/types.h>
 #include <stdlib.h>
+#include <time.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
@@ -1458,8 +1459,18 @@
 VOID WINAPI GlobalMemoryStatus(
             LPMEMORYSTATUS lpmem
 ) {
+    static MEMORYSTATUS	cached_memstatus;
+    static int cache_lastchecked = 0;
+    FILE *f;
+
+    if (time(NULL)==cache_lastchecked) {
+	memcpy(lpmem,&cached_memstatus,sizeof(MEMORYSTATUS));
+	return;
+    }
+    cache_lastchecked = time(NULL);
+
 #ifdef linux
-    FILE *f = fopen( "/proc/meminfo", "r" );
+    f = fopen( "/proc/meminfo", "r" );
     if (f)
     {
         char buffer[256];