Skip to content

Commit 9712c09

Browse files
authored
Remove a static allocation from Fetch JS code (#12040)
Helps WebAssembly/binaryen#3043
1 parent c233703 commit 9712c09

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/library_fetch.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ var LibraryFetch = {
1212
#else
1313
$Fetch__postset: 'Fetch.staticInit();',
1414
#endif
15-
fetch_work_queue: '{{{ makeStaticAlloc(12) }}}',
15+
$fetchWorkQueue: '0',
1616
$Fetch: Fetch,
17-
_emscripten_get_fetch_work_queue__deps: ['fetch_work_queue'],
17+
_emscripten_get_fetch_work_queue__deps: ['$fetchWorkQueue'],
1818
_emscripten_get_fetch_work_queue: function() {
19-
return _fetch_work_queue;
19+
if (!fetchWorkQueue) fetchWorkQueue = _malloc(12);
20+
return fetchWorkQueue;
2021
},
2122
_emscripten_fetch_get_response_headers_length: _fetch_get_response_headers_length,
2223
_emscripten_fetch_get_response_headers: _fetch_get_response_headers,

0 commit comments

Comments
 (0)