summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-11-26 00:06:22 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-11-26 00:06:22 +0300
commit616f2a79082379a345a69f047148c549cedfce95 (patch)
treec771fa4c568381be8a7557f43f17220a6a23a64a /include
parentfda6160da0f130f6fea8137a734b7069c9392d7f (diff)
downloadbdwgc-616f2a79082379a345a69f047148c549cedfce95.tar.gz
Fix unconditional out-of-memory in GC_[p]valloc on Emscripten and NACL
(fix of commit d4c81638d) Issue #495 (bdwgc). * include/private/gcconfig.h [NACL && !HBLKSIZE && !GC_NO_VALLOC] (HBLKSIZE): Define to GETPAGESIZE(); add TODO item. * include/private/gcconfig.h [I386 && EMSCRIPTEN && !HBLKSIZE && !GC_NO_VALLOC] (HBLKSIZE): Define to 65536; add comment and TODO item. Co-authored-by: Jukka Jylanki <jujjyl@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/private/gcconfig.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index 01f9b7cb..25b56516 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -1185,6 +1185,9 @@ EXTERN_C_BEGIN
# define NO_PTHREAD_GETATTR_NP
# define USE_MMAP_ANON
# define GETPAGESIZE() 65536 /* FIXME: Not real page size */
+# if !defined(HBLKSIZE) && !defined(GC_NO_VALLOC)
+# define HBLKSIZE GETPAGESIZE() /* TODO: workaround for GC_valloc */
+# endif
# define MAX_NACL_GC_THREADS 1024
# endif
@@ -1295,6 +1298,10 @@ EXTERN_C_BEGIN
/* native support of memory mapping. Use sbrk() instead. */
# undef USE_MMAP
# undef USE_MUNMAP
+ /* The real page size in WebAssembly is 64 KB. */
+# if !defined(HBLKSIZE) && !defined(GC_NO_VALLOC)
+# define HBLKSIZE 65536 /* TODO: workaround for GC_valloc */
+# endif
# if defined(GC_THREADS) && !defined(CPPCHECK)
# error No threads support yet
# endif