]> code.delx.au - gnu-emacs/blobdiff - src/w32heap.c
Update copyright year to 2014 by running admin/update-copyright.
[gnu-emacs] / src / w32heap.c
index 8b9b19ea35de383499863d2c0cc0a7eb3368454b..8ab2f58c6e70c6a80849f9ec15163393e9e4638d 100644 (file)
@@ -1,5 +1,5 @@
 /* Heap management routines for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1994, 2001-201 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2014 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -23,65 +23,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <stdio.h>
 
+#include "w32common.h"
 #include "w32heap.h"
 #include "lisp.h"  /* for VALMASK */
 
 #define RVA_TO_PTR(rva) ((unsigned char *)((DWORD_PTR)(rva) + (DWORD_PTR)GetModuleHandle (NULL)))
 
-/* This gives us the page size and the size of the allocation unit on NT.  */
-SYSTEM_INFO sysinfo_cache;
-
-/* This gives us version, build, and platform identification.  */
-OSVERSIONINFO osinfo_cache;
-
-size_t syspage_mask = 0;
-
-/* The major and minor versions of NT.  */
-int w32_major_version;
-int w32_minor_version;
-int w32_build_number;
-
-/* Distinguish between Windows NT and Windows 95.  */
-int os_subtype;
-
-/* Cache information describing the NT system for later use.  */
-void
-cache_system_info (void)
-{
-  union
-    {
-      struct info
-       {
-         char  major;
-         char  minor;
-         short platform;
-       } info;
-      DWORD data;
-    } version;
-
-  /* Cache the version of the operating system.  */
-  version.data = GetVersion ();
-  w32_major_version = version.info.major;
-  w32_minor_version = version.info.minor;
-
-  if (version.info.platform & 0x8000)
-    os_subtype = OS_9X;
-  else
-    os_subtype = OS_NT;
-
-  /* Cache page size, allocation unit, processor type, etc.  */
-  GetSystemInfo (&sysinfo_cache);
-  syspage_mask = sysinfo_cache.dwPageSize - 1;
-
-  /* Cache os info.  */
-  osinfo_cache.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-  GetVersionEx (&osinfo_cache);
-
-  w32_build_number = osinfo_cache.dwBuildNumber;
-  if (os_subtype == OS_9X)
-    w32_build_number &= 0xffff;
-}
-
 /* Emulate getpagesize.  */
 int
 getpagesize (void)
@@ -131,7 +78,7 @@ allocate_heap (void)
   while (!ptr && (base < end))
     {
 #ifdef _WIN64
-      reserved_heap_size = min(end - base, 0x4000000000i64); /* Limit to 256Gb */
+      reserved_heap_size = min(end - base, 0x4000000000ull); /* Limit to 256Gb */
 #else
       reserved_heap_size = end - base;
 #endif
@@ -149,9 +96,13 @@ static char *
 allocate_heap (void)
 {
 #ifdef _WIN64
-  size_t size = 0x4000000000i64; /* start by asking for 32GB */
+  size_t size = 0x4000000000ull; /* start by asking for 32GB */
 #else
-  size_t size = 0x80000000; /* start by asking for 2GB */
+  /* We used to start with 2GB here, but on Windows 7 that would leave
+     too little room in the address space for threads started by
+     Windows on our behalf, e.g. when we pop up the file selection
+     dialog.  */
+  size_t size = 0x68000000; /* start by asking for 1.7GB */
 #endif
   void *ptr = NULL;