Track memory allocations with a linked list. This is only about 3x slower than without tracking instead of 5x and growing.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4192 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-02-19 22:28:36 +00:00
parent a6a6fe75ec
commit 86bc46a11e
2 changed files with 97 additions and 44 deletions

View File

@ -851,7 +851,7 @@ static JSValue _tf_task_getAllocations(JSContext* context, JSValueConst this_val
JS_SetPropertyStr(context, allocation, "size", JS_NewInt64(context, allocation_info[i].size));
JS_SetPropertyStr(context, allocation, "count", JS_NewInt32(context, allocation_info[i].count));
const char* stack = tf_util_backtrace_to_string(allocation_info[i].frames, allocation_info[i].frames_count);
JS_SetPropertyStr(context, allocation, "stack", JS_NewString(context, stack));
JS_SetPropertyStr(context, allocation, "stack", JS_NewString(context, stack ? stack : ""));
tf_free((void*)stack);
JS_SetPropertyUint32(context, allocations, i, allocation);
}