Skip to content

Commit

Permalink
[WiP] Build with -sALLOW_MEMORY_GROWTH
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Sep 21, 2023
1 parent 2b3f337 commit b3a4de6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ set(MAIN_COMPILE_OPTIONS
# -sSYSCALL_DEBUG \
# -sDYLINK_DEBUG \

# note 1: `ALLOW_MEMORY_GROWTH` may run non-wasm code slowly. See: https://github.com/WebAssembly/design/issues/1271.
# note 2: Browsers appear to limit the maximum initial memory size to 1GB, set `INITIAL_MEMORY` accordingly.
# note 3: Build with `-sALLOW_TABLE_GROWTH` so that we can store the read, seek, write and finish signals.
# note 4: To ensure the testsuite passes, increase (main-)thread's stack size from 64kb to 256kb. This should be
# note 1: Build with `-sALLOW_MEMORY_GROWTH` to accommodate unpredictable image sizes. Allowing memory to expand
# gradually is a more efficient approach than over-allocating in resource-limited environments.
# note 2: Build with `-sALLOW_TABLE_GROWTH` so that we can store the read, seek, write and finish signals.
# note 3: To ensure the testsuite passes, increase (main-)thread's stack size from 64kb to 256kb. This should be
# reasonable for image processing in Wasm, and given that libvips enforces a minimum thread stack size of 2mb
# on other POSIX platforms.
set(MAIN_LINK_OPTIONS
Expand All @@ -125,8 +125,9 @@ set(MAIN_LINK_OPTIONS
-sMODULARIZE
-sEXPORT_NAME='Vips'
-sEXIT_RUNTIME
-sINITIAL_MEMORY=1GB
-sINITIAL_MEMORY=128MB
-sSTACK_SIZE=256KB
-sALLOW_MEMORY_GROWTH
-sALLOW_TABLE_GROWTH
-sALLOW_BLOCKING_ON_MAIN_THREAD
-sTEXTDECODER=2
Expand Down

0 comments on commit b3a4de6

Please sign in to comment.