2009-09-16 Ivan Maidanski <ivmai@mail.ru>
+ (ivmai125.diff)
+
+ * os_dep.c (GC_wince_get_mem): If VirtualAlloc() returns NULL (due
+ to out of memory) then don't increment GC_n_heap_bases and don't
+ call VirtualAlloc() again (with MEM_COMMIT).
+ * os_dep.c (GC_remap): Abort with a more informatory message if
+ VirtualAlloc() fails due to out of memory; update FIXME.
+
+2009-09-16 Ivan Maidanski <ivmai@mail.ru>
(ivmai132.diff - superseding diff41a, diff64, diff84 partly)
* Makefile: Fix typo for msvc_dbg.c.
/* If I read the documentation correctly, this can */
/* only happen if HBLKSIZE > 64k or not a power of 2. */
if (GC_n_heap_bases >= MAX_HEAP_SECTS) ABORT("Too many heap sections");
+ if (result == NULL) return NULL;
GC_heap_bases[GC_n_heap_bases] = result;
GC_heap_lengths[GC_n_heap_bases] = 0;
GC_n_heap_bases++;
ptr_t end_addr = GC_unmap_end(start, bytes);
word len = end_addr - start_addr;
- /* FIXME: Should we handle out-of-memory here? */
+ /* FIXME: Handle out-of-memory correctly (at least for Win32) */
# if defined(MSWIN32) || defined(MSWINCE)
ptr_t result;
MEM_COMMIT,
PAGE_EXECUTE_READWRITE);
if (result != start_addr) {
- ABORT("VirtualAlloc remapping failed");
+ if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
+ GetLastError() == ERROR_OUTOFMEMORY) {
+ ABORT("Not enough memory to process remapping");
+ } else {
+ ABORT("VirtualAlloc remapping failed");
+ }
}
GC_unmapped_bytes -= alloc_len;
start_addr += alloc_len;