diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-01 21:53:59 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-01 21:53:59 -0500 |
commit | c022f1839b955129527085f13e74805febf0fa66 (patch) | |
tree | 01d41fc30c984be25fa263cc886fe2e22e9479f6 /src | |
parent | 95a202de757b7453314cf1139a4a9fa5091ae9da (diff) |
limit memory growth to 1GB
Diffstat (limited to 'src')
-rw-r--r-- | src/preamble.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js index 0bfeda1b..8bde7284 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -566,6 +566,7 @@ function enlargeMemory() { while (TOTAL_MEMORY <= STATICTOP) { // Simple heuristic. Override enlargeMemory() if your program has something more optimal for it TOTAL_MEMORY = alignMemoryPage(2*TOTAL_MEMORY); } + assert(TOTAL_MEMORY <= Math.pow(2, 30)); // 2^30==1GB is a practical maximum - 2^31 is already close to possible negative numbers etc. #if USE_TYPED_ARRAYS == 1 var oldIHEAP = IHEAP; Module['HEAP'] = Module['IHEAP'] = HEAP = IHEAP = new Int32Array(TOTAL_MEMORY); |