MCPcopy Index your code
hub / github.com/sql-js/sql.js / dynamicAlloc

Function dynamicAlloc

js/sql-debug.js:307–320  ·  view source on GitHub ↗
(size)

Source from the content-addressed store, hash-verified

305}
306
307function dynamicAlloc(size) {
308 assert(DYNAMICTOP_PTR);
309 var ret = HEAP32[DYNAMICTOP_PTR>>2];
310 var end = (ret + size + 15) & -16;
311 HEAP32[DYNAMICTOP_PTR>>2] = end;
312 if (end >= TOTAL_MEMORY) {
313 var success = enlargeMemory();
314 if (!success) {
315 HEAP32[DYNAMICTOP_PTR>>2] = ret;
316 return 0;
317 }
318 }
319 return ret;
320}
321
322function alignMemory(size, factor) {
323 if (!factor) factor = STACK_ALIGN; // stack alignment (16-byte) by default

Callers 1

getMemoryFunction · 0.70

Calls 2

assertFunction · 0.70
enlargeMemoryFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…