malloc/free problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
DarkJarek
Posts: 3
Joined: Thu Apr 26, 2007 12:24 am

malloc/free problem

Post by DarkJarek »

Hi, I'm writing malloc and have problem how do it.
I have 2 ideas:

1.
-free blocks will be linked in 2-direction list
-when i want alloc block, malloc searching list for first free fit block
-when i want to free block, free function add it to list at beginning
-sometimes list have been sorted and neighbouring block have been marged

2.
similarly as above but:
-list are always sorted

3.
Maybe there are better way :)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: malloc/free problem

Post by Combuster »

dlmalloc :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply