diff options
author | Eli Zaretskii <eliz@gnu.org> | 2011-04-29 17:23:44 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2011-04-29 17:23:44 +0300 |
commit | fab624aa3a159b3d91fae009634dd0875a5b0162 (patch) | |
tree | 564eeadecadf82edd897b3b1d43e2058ce9820fc /src/w32heap.c | |
parent | b1c07b7b76ee4ae685e491f4e98129a77d8c18a9 (diff) |
Allow the Windows build to use upto 2GB of heap.
src/w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]:
New version that can reserve upto 2GB of heap space.
etc/NEWS: Mention the new feature.
Diffstat (limited to 'src/w32heap.c')
-rw-r--r-- | src/w32heap.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/w32heap.c b/src/w32heap.c index b5b18919a4..91bc8133b2 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -119,6 +119,7 @@ get_data_end (void) return data_region_end; } +#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG) static char * allocate_heap (void) { @@ -145,9 +146,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) { |