Skip to content

Commit 05b28e5

Browse files
committed
Merge pull request sql-js#143 from dinedal/allow_memory_growth
Make a version of sql.js compiled with ALLOW_MEMORY_GROWTH=1
2 parents b8bb915 + 076cd36 commit 05b28e5

File tree

6 files changed

+92827
-74612
lines changed

6 files changed

+92827
-74612
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ EMCC=$(EMSCRIPTEN)/emcc
66

77
CFLAGS=-DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DISABLE_LFS -DLONGDOUBLE_TYPE=double -DSQLITE_INT64_TYPE="long long int" -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS
88

9-
all: js/sql.js js/sql-debug.js js/worker.sql.js
9+
all: js/sql.js debug js/worker.sql.js memory-growth
1010

1111
# RESERVED_FUNCTION_POINTERS setting is used for registering custom functions
1212
debug: EMFLAGS= -O1 -g -s INLINING_LIMIT=10 -s RESERVED_FUNCTION_POINTERS=64
@@ -15,6 +15,9 @@ debug: js/sql-debug.js
1515
optimized: EMFLAGS= --memory-init-file 0 --closure 1 -O3 -s INLINING_LIMIT=50 -s RESERVED_FUNCTION_POINTERS=64
1616
optimized: js/sql-optimized.js
1717

18+
memory-growth: EMFLAGS= --memory-init-file 0 --closure 1 -O3 -s INLINING_LIMIT=50 -s RESERVED_FUNCTION_POINTERS=64 -s ALLOW_MEMORY_GROWTH=1
19+
memory-growth: js/sql-memory-growth.js
20+
1821
js/sql.js: optimized
1922
cp js/sql-optimized.js js/sql.js
2023

@@ -46,6 +49,6 @@ module.tar.gz: test package.json AUTHORS README.md js/sql.js
4649
tar --create --gzip $^ > $@
4750

4851
clean:
49-
rm -rf js/sql.js js/api.js js/sql*-raw.js js/worker.sql.js js/worker.js c/sqlite3.bc c/extension-functions.bc
52+
rm -rf js/sql.js js/api.js js/sql*-raw.js js/worker.sql.js js/worker.js js/sql-memory-growth.js c/sqlite3.bc c/extension-functions.bc
5053

5154

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ See : https://github.com/kripken/sql.js/blob/master/test/test_worker.js
190190
## Downloads
191191
- You can download `sql.js` here : https://raw.githubusercontent.com/kripken/sql.js/master/js/sql.js
192192
- And the Web Worker version: https://raw.githubusercontent.com/kripken/sql.js/master/js/worker.sql.js
193+
- You can find a non minified or optimized version for debugging, `sql-debug.js` here : https://raw.githubusercontent.com/kripken/sql.js/master/js/sql-debug.js
194+
- If you see the message, `Cannot enlarge memory arrays`, try this version, `sql-memory-growth.js` here : https://raw.githubusercontent.com/kripken/sql.js/master/js/sql-memory-growth.js
193195

194196
## Related
195197

js/sql-debug.js

Lines changed: 92304 additions & 74606 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)