summaryrefslogtreecommitdiff
path: root/src/w32heap.c
diff options
context:
space:
mode:
authorGeoff Voelker <voelker@cs.washington.edu>1996-05-11 06:38:25 +0000
committerGeoff Voelker <voelker@cs.washington.edu>1996-05-11 06:38:25 +0000
commit1dc5f71bc236bcc95dd55539be4e6e6b465939a6 (patch)
tree4de300745c6b9fc58a15ca6aebc7bdd4547c8b28 /src/w32heap.c
parent3d9eccce7ade11b1a2cc0be49c46d1c7d0c3a049 (diff)
downloademacs-1dc5f71bc236bcc95dd55539be4e6e6b465939a6.tar.gz
(allocate_heap): Bump heap base up to 27MB to
wsatisfy Win95.
Diffstat (limited to 'src/w32heap.c')
-rw-r--r--src/w32heap.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/w32heap.c b/src/w32heap.c
index 28d44e54b21..776f857f3a5 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -131,20 +131,31 @@ allocate_heap (void)
size could be roughly double, so if we allow 4MB for the executable
we will have plenty of room for expansion.
- Thus we set the malloc heap base to 20MB. Since Emacs now leaves
+ Thus we would like to set the malloc heap base to 20MB. However,
+ Win95 refuses to allocate the heap starting at this address, so we
+ set the base to 27MB to make it happy. Since Emacs now leaves
28 bits available for pointers, this lets us use the remainder of
- the region below the 256MB line for our malloc arena - 236MB is
- still a pretty decent arena to play in! */
+ the region below the 256MB line for our malloc arena - 229MB is
+ still a pretty decent arena to play in! */
- unsigned long base = 0x01400000; /* 20MB */
+ unsigned long base = 0x01B00000; /* 27MB */
unsigned long end = 1 << VALBITS; /* 256MB */
+ void *ptr = NULL;
- reserved_heap_size = end - base;
-
- return VirtualAlloc ((void *) base,
- get_reserved_heap_size (),
- MEM_RESERVE,
- PAGE_NOACCESS);
+#ifdef NTHEAP_PROBE_BASE
+ while (!ptr && (base < end))
+ {
+#endif
+ reserved_heap_size = end - base;
+ ptr = VirtualAlloc ((void *) base,
+ get_reserved_heap_size (),
+ MEM_RESERVE,
+ PAGE_NOACCESS);
+#ifdef NTHEAP_PROBE_BASE
+ base += 0x00100000; /* 1MB increment */
+ }
+#endif
+ return ptr;
}