diff options
| author | Eli Zaretskii | 2011-04-29 17:23:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-04-29 17:23:44 +0300 |
| commit | fab624aa3a159b3d91fae009634dd0875a5b0162 (patch) | |
| tree | 564eeadecadf82edd897b3b1d43e2058ce9820fc /src | |
| parent | b1c07b7b76ee4ae685e491f4e98129a77d8c18a9 (diff) | |
| download | emacs-fab624aa3a159b3d91fae009634dd0875a5b0162.tar.gz emacs-fab624aa3a159b3d91fae009634dd0875a5b0162.zip | |
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')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/w32heap.c | 25 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b6f962f4523..42d9185e0dd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-04-29 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]: | ||
| 4 | New version that can reserve upto 2GB of heap space. | ||
| 5 | |||
| 1 | 2011-04-26 Chong Yidong <cyd@stupidchicken.com> | 6 | 2011-04-26 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 7 | ||
| 3 | * nsfns.m (Fns_read_file_name): Doc fix (Bug#8534). | 8 | * nsfns.m (Fns_read_file_name): Doc fix (Bug#8534). |
diff --git a/src/w32heap.c b/src/w32heap.c index b5b18919a4a..91bc8133b20 100644 --- a/src/w32heap.c +++ b/src/w32heap.c | |||
| @@ -119,6 +119,7 @@ get_data_end (void) | |||
| 119 | return data_region_end; | 119 | return data_region_end; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | #if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG) | ||
| 122 | static char * | 123 | static char * |
| 123 | allocate_heap (void) | 124 | allocate_heap (void) |
| 124 | { | 125 | { |
| @@ -145,9 +146,31 @@ allocate_heap (void) | |||
| 145 | 146 | ||
| 146 | return ptr; | 147 | return ptr; |
| 147 | } | 148 | } |
| 149 | #else /* USE_LISP_UNION_TYPE || USE_LSB_TAG */ | ||
| 150 | static char * | ||
| 151 | allocate_heap (void) | ||
| 152 | { | ||
| 153 | unsigned long size = 0x80000000; /* start by asking for 2GB */ | ||
| 154 | void *ptr = NULL; | ||
| 155 | |||
| 156 | while (!ptr && size > 0x00100000) | ||
| 157 | { | ||
| 158 | reserved_heap_size = size; | ||
| 159 | ptr = VirtualAlloc (NULL, | ||
| 160 | get_reserved_heap_size (), | ||
| 161 | MEM_RESERVE, | ||
| 162 | PAGE_NOACCESS); | ||
| 163 | size -= 0x00800000; /* if failed, decrease request by 8MB */ | ||
| 164 | } | ||
| 165 | |||
| 166 | return ptr; | ||
| 167 | } | ||
| 168 | #endif /* USE_LISP_UNION_TYPE || USE_LSB_TAG */ | ||
| 148 | 169 | ||
| 149 | 170 | ||
| 150 | /* Emulate Unix sbrk. */ | 171 | /* Emulate Unix sbrk. Note that ralloc.c expects the return value to |
| 172 | be the address of the _start_ (not end) of the new block in case of | ||
| 173 | success, and zero (not -1) in case of failure. */ | ||
| 151 | void * | 174 | void * |
| 152 | sbrk (unsigned long increment) | 175 | sbrk (unsigned long increment) |
| 153 | { | 176 | { |