-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
enhancementNew feature or requestNew feature or requestkernelThis changes are in kernelThis changes are in kernel
Description
When kfree is called, it uses sizeof() to get the size of the pointer. However, if I'm remembering correctly, this will return the size of the pointer, not the size of the memory region. I would recommend adding a header above each region of memory to keep track of region sizes and the like. An example header could be:
typedef struct
{
uint32_t size;
int magic;
} mem_header_t;
You could then allocate a region of the requested size plus the size of the header, and insert one above the region allocated. The pointer returned would point to the memory beneath the header, so just subtract the size of the header from the pointer to get the header's address.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestkernelThis changes are in kernelThis changes are in kernel