Abort if munmap or protect_pages fails
On Linux, munmap can fail when you run out of mappable regions. If protect_pages fails, then you can't install a write barrier
This commit is contained in:
parent
cc25a27f87
commit
07f35d248c
|
@ -19,6 +19,7 @@ static void os_free_pages(void *p, size_t len)
|
|||
{
|
||||
if (munmap(p, len)) {
|
||||
GCPRINT(GCOUTF, "unmap failed: %lx, %ld, %d\n", (long)p, (long)len, errno);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,8 +52,10 @@ static void *os_alloc_pages(size_t len)
|
|||
|
||||
static void os_protect_pages(void *p, size_t len, int writeable)
|
||||
{
|
||||
if (mprotect(p, len, (writeable ? (PROT_READ | PROT_WRITE) : PROT_READ)))
|
||||
if (mprotect(p, len, (writeable ? (PROT_READ | PROT_WRITE) : PROT_READ))) {
|
||||
GCPRINT(GCOUTF, "mprotect failed: %lx, %ld, %d, %d\n", (long)p, (long)len, writeable, errno);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
#include "rlimit_heapsize.c"
|
||||
|
|
|
@ -219,6 +219,7 @@ static void os_protect_pages(void *p, size_t len, int writeable)
|
|||
if(retval != KERN_SUCCESS) {
|
||||
GCPRINT(GCOUTF, "WARNING: couldn't protect %li bytes of page %p%s\n",
|
||||
len, p, mach_error_string(retval));
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user