|
-
November 30th, 2004, 08:40 PM
#2
Re: Implementing malloc...
I can't recall the exact details. Please correct me if I am wrong. It is roughly something like, for each allocated memory block, the first few bytes (header) have to store the memory block size. Beside that, this header also store a pointer to the next allocated memory block. In other words, the headers form a linked list that you can trace from one allocated memory block to another. Similarly, to mark where are your free memory blocks, free memory blocks also reserve a header with pointer to the next free memory block as well as the size of the present memory block.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|