Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -6426,28 +6426,21 @@ def test_file_packager_huge(self):
self.assertContained(MESSAGE, err)
self.clear()

@parameterized({
'': (True,),
'wasm2js': (False,),
})
def test_massive_alloc(self, wasm):
@also_with_wasm2js
def test_memory_growth(self):
create_file('main.c', r'''
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>

int main() {
volatile long x = (long)malloc(1024 * 1024 * 1400);
return x == 0; // can't alloc it, but don't fail catastrophically, expect null
void* x = malloc(256 * 1024 * 1024);
assert(x != NULL);
return 0;
}
''')
cmd = [EMCC, 'main.c', '-sALLOW_MEMORY_GROWTH', '-sINITIAL_MEMORY=16MB']
if not wasm:
cmd += ['-sWASM=0']
self.run_process(cmd)
# just care about message regarding allocating over 1GB of memory
output = self.run_js('a.out.js')
if not wasm:
self.assertContained('Warning: Enlarging memory arrays, this is not fast! 16777216,1468137472\n', output)
''')
output = self.do_runf('main.c', cflags=['-sALLOW_MEMORY_GROWTH'])
if self.is_wasm2js():
self.assertContained('Warning: Enlarging memory arrays, this is not fast! 16908288,268566528\n', output)

@also_with_wasm2js
@parameterized({
Expand Down
Loading