System/Setup/Environment+FFI/LibC: Increase calloc/malloc mem_tasks
Give LibC malloc() and calloc() an array of 16 mem_tasks each, for now. We will probably be removing this, in favor of giving each non-HolyC library its own static memory pool, as we will do with stb_truetype.h in a forthcoming commit.
This commit is contained in:
parent
b7cab3b419
commit
b40820272f
2 changed files with 20 additions and 4 deletions
|
@ -12,8 +12,8 @@ U0 bcmp()
|
|||
|
||||
U64 @calloc(I64 size)
|
||||
{
|
||||
U64 res = CAlloc(size, malloc_mem_task[malloc_current_mem_task % MALLOC_MEM_TASK_COUNT]->code_heap);
|
||||
malloc_current_mem_task++;
|
||||
U64 res = CAlloc(size, calloc_mem_task[calloc_current_mem_task % CALLOC_MEM_TASK_COUNT]->code_heap);
|
||||
calloc_current_mem_task++;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,8 +169,8 @@ sys_code_bp->mem_free_lst = ShrinkMemBlkByPags(sys_code_bp->mem_free_lst, 131072
|
|||
|
||||
CTask* erythros_mem_task = Spawn(&@erythros_mem_task_loop, , "ErythrosMemTask");
|
||||
|
||||
#define MALLOC_MEM_TASK_COUNT 4
|
||||
CTask** malloc_mem_task = CAlloc(sizeof(CTask*) * MALLOC_MEM_TASK_COUNT, erythros_mem_task);
|
||||
#define MALLOC_MEM_TASK_COUNT 16
|
||||
CTask** malloc_mem_task = CAlloc(sizeof(CTask*) * MALLOC_MEM_TASK_COUNT, adam_task);
|
||||
I64 malloc_current_mem_task = 0;
|
||||
|
||||
U0 @malloc_mem_tasks_init()
|
||||
|
@ -185,6 +185,22 @@ U0 @malloc_mem_tasks_init()
|
|||
|
||||
@malloc_mem_tasks_init;
|
||||
|
||||
#define CALLOC_MEM_TASK_COUNT 16
|
||||
CTask** calloc_mem_task = CAlloc(sizeof(CTask*) * CALLOC_MEM_TASK_COUNT, adam_task);
|
||||
I64 calloc_current_mem_task = 0;
|
||||
|
||||
U0 @calloc_mem_tasks_init()
|
||||
{
|
||||
U8* scratch_buffer[64];
|
||||
I64 i;
|
||||
for (i = 0; i < CALLOC_MEM_TASK_COUNT; i++) {
|
||||
StrPrint(scratch_buffer, "ErythrosCallocTask%d", i);
|
||||
calloc_mem_task[i] = Spawn(&@erythros_mem_task_loop, , scratch_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@calloc_mem_tasks_init;
|
||||
|
||||
U0 dd() { DocDump(adam_task->put_doc); }
|
||||
//@patch_jmp_rel32(&Fault2, &Reboot); // Reboot instead of crashing to the debugger
|
||||
U0 NoBeep(I8, Bool) {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue