Skip to content

Commit 437c7b3

Browse files
committed
Deprecate the USES_DYNAMIC_ALLOC setting
All this setting was doing was setting MALLOC=none so it doesn't seem like it needs to exist as a separate setting. I think it used to do more, for example, prior to #12790 it used was used in some JS library code. Another PR that removed a lot of usage of this settings was #12057. Simply removing it simplifies another change I'm working on: #18905. Also, the docs were incorrect in stating it was ignored except under MINIMAL_RUNTIME, but we had no testing for it.
1 parent 3c5bac9 commit 437c7b3

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

emcc.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,10 +2331,6 @@ def phase_linker_setup(options, state, newargs):
23312331
'_wasmfs_readdir_finish',
23322332
]
23332333

2334-
# Explicitly drop linking in a malloc implementation if program is not using any dynamic allocation calls.
2335-
if not settings.USES_DYNAMIC_ALLOC:
2336-
settings.MALLOC = 'none'
2337-
23382334
if settings.FETCH and final_suffix in EXECUTABLE_ENDINGS:
23392335
state.forced_stdlibs.append('libfetch')
23402336
settings.JS_LIBRARIES.append((0, 'library_fetch.js'))

src/settings.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,13 +1851,6 @@ var MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION = false;
18511851
// [link]
18521852
var MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION = false;
18531853

1854-
// If building with MINIMAL_RUNTIME=1 and application uses sbrk()/malloc(),
1855-
// enable this. If you are not using dynamic allocations, can set this to 0 to
1856-
// save code size. This setting is ignored when building with -s
1857-
// MINIMAL_RUNTIME=0.
1858-
// [link]
1859-
var USES_DYNAMIC_ALLOC = true;
1860-
18611854
// If set to 'emscripten' or 'wasm', compiler supports setjmp() and longjmp().
18621855
// If set to 0, these APIs are not available. If you are using C++ exceptions,
18631856
// but do not need setjmp()+longjmp() API, then you can set this to 0 to save a
@@ -2175,4 +2168,5 @@ var LEGACY_SETTINGS = [
21752168
['LLD_REPORT_UNDEFINED', [1], 'Disabling is no longer supported'],
21762169
['MEM_INIT_METHOD', [0], 'No longer supported'],
21772170
['USE_PTHREADS', [0, 1], 'No longer needed. Use -pthread instead'],
2171+
['USES_DYNAMIC_ALLOC', [1], 'No longer supported. Use -sMALLOC=none'],
21782172
];

test/test_other.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9993,14 +9993,14 @@ def test_minimal_runtime_code_size(self, test_name, js, compare_js_output=False)
99939993

99949994
math_sources = [test_file('code_size/math.c')]
99959995
hello_world_sources = [test_file('small_hello_world.c'),
9996-
'-sUSES_DYNAMIC_ALLOC=0']
9996+
'-sMALLOC=none']
99979997
random_printf_sources = [test_file('hello_random_printf.c'),
9998-
'-sUSES_DYNAMIC_ALLOC=0',
9998+
'-sMALLOC=none',
99999999
'-sSINGLE_FILE']
1000010000
hello_webgl_sources = [test_file('minimal_webgl/main.cpp'),
1000110001
test_file('minimal_webgl/webgl.c'),
1000210002
'--js-library', test_file('minimal_webgl/library_js.js'),
10003-
'-sUSES_DYNAMIC_ALLOC', '-lwebgl.js',
10003+
'-lwebgl.js',
1000410004
'-sMODULARIZE']
1000510005
hello_webgl2_sources = hello_webgl_sources + ['-sMAX_WEBGL_VERSION=2']
1000610006
hello_wasm_worker_sources = [test_file('wasm_worker/wasm_worker_code_size.c'), '-sWASM_WORKERS', '-sENVIRONMENT=web,worker']

0 commit comments

Comments
 (0)