summaryrefslogtreecommitdiff
path: root/src/w32heap.c
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2011-05-04 21:00:38 -0700
committerGlenn Morris <rgm@gnu.org>2011-05-04 21:00:38 -0700
commitf7ff1b0f0792f1f870778404531e68e77832c4a1 (patch)
tree23cb550bdd3313df9b9b21a39a1a6c37c3258eec /src/w32heap.c
parent9869b3ae6b4dc59d522f80b405250139e49cc9b9 (diff)
parent9bb095f46e44b642d3420a5f3b8d1443dab1b016 (diff)
Merge from emacs-23; up to 2010-06-10T05:17:21Z!rgm@gnu.org.
Diffstat (limited to 'src/w32heap.c')
-rw-r--r--src/w32heap.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/w32heap.c b/src/w32heap.c
index bbdabd2350..477c11a516 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -114,6 +114,7 @@ get_data_end (void)
return data_region_end;
}
+#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG)
static char *
allocate_heap (void)
{
@@ -140,9 +141,31 @@ allocate_heap (void)
return ptr;
}
+#else /* USE_LISP_UNION_TYPE || USE_LSB_TAG */
+static char *
+allocate_heap (void)
+{
+ unsigned long size = 0x80000000; /* start by asking for 2GB */
+ void *ptr = NULL;
+
+ while (!ptr && size > 0x00100000)
+ {
+ reserved_heap_size = size;
+ ptr = VirtualAlloc (NULL,
+ get_reserved_heap_size (),
+ MEM_RESERVE,
+ PAGE_NOACCESS);
+ size -= 0x00800000; /* if failed, decrease request by 8MB */
+ }
+
+ return ptr;
+}
+#endif /* USE_LISP_UNION_TYPE || USE_LSB_TAG */
-/* Emulate Unix sbrk. */
+/* Emulate Unix sbrk. Note that ralloc.c expects the return value to
+ be the address of the _start_ (not end) of the new block in case of
+ success, and zero (not -1) in case of failure. */
void *
sbrk (unsigned long increment)
{