Reimplementing software building blocks like malloc and free in D
Eugene Wissner
belka at caraus.de
Sun Aug 12 07:00:30 UTC 2018
On Sunday, 12 August 2018 at 06:44:37 UTC, Aruna Maurya wrote:
> On Sunday, 12 August 2018 at 05:24:56 UTC, Mike Franklin wrote:
>> On Sunday, 12 August 2018 at 04:16:24 UTC, Aruna Maurya wrote:
>>
>>> [...]
>>
>> I'd say there is only 1 requirement: implementing `malloc`,
>> `realloc`, and `free` in idiomatic D without any dependencies
>> on other libraries from other languages.
>>
>> [...]
> Also what about other implementations like memset or memcmp.
> Have they been implemented or require work from scratch?
These functions are still mostly implemented in asm, so I'm not
sure there is an "idiomatic D" way. I would only wrap them into a
function working with slices and checking the length. Mike?
>
> So the only option to implement the above is to go through
> Eugene's code, take some measurements and see if it can be
> improved.
>
As said my allocator is nothing official but I would be overhappy
if someone finds it useful. I can also advice to look at Doug Lea
malloc:
http://g.oswego.edu/dl/html/malloc.html
It is like a book. It's one of the best documented programs I've
ever seen.
More information about the Digitalmars-d
mailing list