@@ -1409,7 +1409,7 @@ void *js_calloc_rt(JSRuntime *rt, size_t count, size_t size)
14091409 return NULL;
14101410
14111411 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;
14131413 return ptr;
14141414}
14151415
@@ -1431,7 +1431,7 @@ void *js_malloc_rt(JSRuntime *rt, size_t size)
14311431 return NULL;
14321432
14331433 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;
14351435 return ptr;
14361436}
14371437
@@ -1444,7 +1444,7 @@ void js_free_rt(JSRuntime *rt, void *ptr)
14441444
14451445 s = &rt->malloc_state;
14461446 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;
14481448 rt->mf.js_free(s->opaque, ptr);
14491449}
14501450
@@ -1462,7 +1462,7 @@ void *js_realloc_rt(JSRuntime *rt, void *ptr, size_t size)
14621462 js_free_rt(rt, ptr);
14631463 return NULL;
14641464 }
1465- old_size = js__malloc_usable_size (ptr);
1465+ old_size = rt->mf.js_malloc_usable_size (ptr);
14661466 s = &rt->malloc_state;
14671467 /* When malloc_limit is 0 (unlimited), malloc_limit - 1 will be SIZE_MAX. */
14681468 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)
14721472 if (!ptr)
14731473 return NULL;
14741474
1475- s->malloc_size += js__malloc_usable_size (ptr) - old_size;
1475+ s->malloc_size += rt->mf.js_malloc_usable_size (ptr) - old_size;
14761476 return ptr;
14771477}
14781478
@@ -1734,7 +1734,7 @@ JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque)
17341734 return NULL;
17351735 /* Inline what js_malloc_rt does since we cannot use it here. */
17361736 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;
17381738 rt->mf = *mf;
17391739 if (!rt->mf.js_malloc_usable_size) {
17401740 /* use dummy function if none provided */
0 commit comments