Reimplementing software building blocks like malloc and free in D

Eugene Wissner belka at caraus.de
Sat Aug 11 19:30:42 UTC 2018


On Saturday, 11 August 2018 at 18:59:00 UTC, Aruna Maurya wrote:
> Hello all! I am a Computer Science undergraduate student. 
> Currently a junior, I find the idea of 're-implementing 
> software building blocks like malloc and free in D' listed in 
> the wiki page of SAOC(Symmetry Autumn of Code) quite 
> interesting.
>
> I don't have experience of coding in D however, I have 4 years 
> of coding in C++ and have a good hold on pointers and the 
> standard template library. I have also successfully completed a 
> course of Operating Systems and Data Structures in my 4th 
> semester. I believe I can pick up D in due course of time.
>
> I had few queries regarding the same and would be glad if 
> anyone could pitch in to help me out.
>
> 1. If it would have been C++, the above can be implemented by 
> using the mmap() syscall to                  allocate memory 
> from the heap. However, something that I am not able to 
> understand in the idea description is 'runtime hooks'.
>
> 2. Also as far as I can understand, this idea is about 
> implementing the above from scratch, and not tweaking the 
> existing codebase. Do let me know if I am wrong.
>
> Thank you for your time!

I missed this project; To let everyone know, I've implemented 
malloc and free:

https://github.com/caraus-ecms/tanya/blob/master/source/tanya/memory/mmappool.d

(see allocate() and deallocate() for a starting point). My 
implementation is just not thread-safe.


More information about the Digitalmars-d mailing list