malloc() in libc.obj gets at least 4k every time #205

Open
opened 2025-04-10 12:53:10 +02:00 by rgimad · 4 comments
Owner

malloc() in libc.obj gets at least 4k every time, because it is just a wrapper of sysfn 68.12 (

) that allocates at least 4k page even if you need i.e 20 bytes.

TODO: write a normal allocator (e.g. dlmalloc, etc.) in malloc() that will request new pages only when neccessary

malloc() in libc.obj gets at least 4k every time, because it is just a wrapper of sysfn 68.12 (https://git.kolibrios.org/KolibriOS/kolibrios/src/commit/fcb9f49785bf55de1616350d942edca9f2a33034/programs/develop/ktcc/trunk/libc.obj/source/stdlib/malloc.c#L6) that allocates at least 4k page even if you need i.e 20 bytes. TODO: write a normal allocator (e.g. dlmalloc, etc.) in malloc() that will request new pages only when neccessary
rgimad added the
C
HLL
Category/Libraries
Priority
Medium
labels 2025-04-10 12:53:10 +02:00
Owner

TODO: write a normal allocator for malloc that will request new pages only when neccessary

Previous devepers told that heap alloc must not be requested for a small portions, such feature has to be done at app level.

> TODO: write a normal allocator for malloc that will request new pages only when neccessary Previous devepers told that heap alloc must not be requested for a small portions, such feature has to be done at app level.
Author
Owner

Previous devepers told that heap alloc must not be requested for a small portions, such feature has to be done at app level.

I say the same thing, sysfn is okay, malloc in library is not okay

> Previous devepers told that heap alloc must not be requested for a small portions, such feature has to be done at app level. I say the same thing, sysfn is okay, malloc in library is not okay
Owner
Do you plan to implement something like this? https://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/system/os/malloc.inc
Author
Owner

yes, dlmalloc looks like a good option

yes, dlmalloc looks like a good option
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KolibriOS/kolibrios#205
No description provided.