Add assertion on result alignment to GC_unix_mmap_get_mem
authorZoltan Varga <vargaz@gmail.com>
Tue, 23 May 2006 15:23:37 +0000 (15:23 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 10 Jan 2012 16:28:31 +0000 (20:28 +0400)
(Apply commit 3e56070 from 'mono_libgc' branch)

* os_dep.c (GC_unix_mmap_get_mem): Add an assert to bail out early if
run on a machine with smaller page size than HBLKSIZE.

os_dep.c

index e6651f4..3b9fa39 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -2075,6 +2075,9 @@ STATIC ptr_t GC_unix_mmap_get_mem(word bytes)
 #   else
       GC_ASSERT(last_addr != 0);
 #   endif
+    if (((word)result % HBLKSIZE) != 0)
+      ABORT(
+       "GC_unix_get_mem: Memory returned by mmap is not aligned to HBLKSIZE.");
     return((ptr_t)result);
 }