@@ -1409,7 +1409,7 @@ void *js_calloc_rt(JSRuntime *rt, size_t count, size_t size)
1409
1409
return NULL;
1410
1410
1411
1411
s->malloc_count++;
1412
- s->malloc_size += js__malloc_usable_size (ptr) + MALLOC_OVERHEAD;
1412
+ s->malloc_size += rt->mf.js_malloc_usable_size (ptr) + MALLOC_OVERHEAD;
1413
1413
return ptr;
1414
1414
}
1415
1415
@@ -1431,7 +1431,7 @@ void *js_malloc_rt(JSRuntime *rt, size_t size)
1431
1431
return NULL;
1432
1432
1433
1433
s->malloc_count++;
1434
- s->malloc_size += js__malloc_usable_size (ptr) + MALLOC_OVERHEAD;
1434
+ s->malloc_size += rt->mf.js_malloc_usable_size (ptr) + MALLOC_OVERHEAD;
1435
1435
return ptr;
1436
1436
}
1437
1437
@@ -1444,7 +1444,7 @@ void js_free_rt(JSRuntime *rt, void *ptr)
1444
1444
1445
1445
s = &rt->malloc_state;
1446
1446
s->malloc_count--;
1447
- s->malloc_size -= js__malloc_usable_size (ptr) + MALLOC_OVERHEAD;
1447
+ s->malloc_size -= rt->mf.js_malloc_usable_size (ptr) + MALLOC_OVERHEAD;
1448
1448
rt->mf.js_free(s->opaque, ptr);
1449
1449
}
1450
1450
@@ -1462,7 +1462,7 @@ void *js_realloc_rt(JSRuntime *rt, void *ptr, size_t size)
1462
1462
js_free_rt(rt, ptr);
1463
1463
return NULL;
1464
1464
}
1465
- old_size = js__malloc_usable_size (ptr);
1465
+ old_size = rt->mf.js_malloc_usable_size (ptr);
1466
1466
s = &rt->malloc_state;
1467
1467
/* When malloc_limit is 0 (unlimited), malloc_limit - 1 will be SIZE_MAX. */
1468
1468
if (s->malloc_size + size - old_size > s->malloc_limit - 1)
@@ -1472,7 +1472,7 @@ void *js_realloc_rt(JSRuntime *rt, void *ptr, size_t size)
1472
1472
if (!ptr)
1473
1473
return NULL;
1474
1474
1475
- s->malloc_size += js__malloc_usable_size (ptr) - old_size;
1475
+ s->malloc_size += rt->mf.js_malloc_usable_size (ptr) - old_size;
1476
1476
return ptr;
1477
1477
}
1478
1478
@@ -1734,7 +1734,7 @@ JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque)
1734
1734
return NULL;
1735
1735
/* Inline what js_malloc_rt does since we cannot use it here. */
1736
1736
ms.malloc_count++;
1737
- ms.malloc_size += js__malloc_usable_size (rt) + MALLOC_OVERHEAD;
1737
+ ms.malloc_size += mf->js_malloc_usable_size (rt) + MALLOC_OVERHEAD;
1738
1738
rt->mf = *mf;
1739
1739
if (!rt->mf.js_malloc_usable_size) {
1740
1740
/* use dummy function if none provided */
0 commit comments