Skip to content

Instantly share code, notes, and snippets.

View quintenpalmer's full-sized avatar
⚙️
let id x = x

Quinten Palmer quintenpalmer

⚙️
let id x = x
View GitHub Profile
@Snaipe
Snaipe / malloc_article.md
Last active June 6, 2022 10:10
malloc_article

Please note that the article is now on my website, and even though I am still working on it, any feedback is appreciated. Thanks for reading !

On the Quest of recoding malloc(3)

Back when I did not know anything about programing and started to learn C, I was first introduced to pointers (and other dreaded horrors that made me curl into a corner and cry) and dynamic memory in general.

I was baffled, troubled, yet fascinated by the basic explanation on how memory worked, and started to dread the time where I would need to manually create my char arrays for each and every sentences of my program; right before learning about string literals and feeling like an idiot.

It was then where I was learning about memory allocation and came upon a function that I would call for long the "magic function" : malloc. Magic, because at that point I didn't know how it worked, let alone knew anything about memory other that it was a "chain of boxes for numbers".