Skip to content

Commit

Permalink
Add malloc-blues
Browse files Browse the repository at this point in the history
  • Loading branch information
angrave committed Apr 18, 2024
1 parent cb09661 commit 161da58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions _docs/malloc.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Don't modify `mcontest.c`, `contest.h`, or `contest-alloc.so`. Those files creat

Your `malloc` must allocate heap memory using `sbrk`. You may not use files, pipes, system shared memory, `mmap`, a chunk of pre-defined stack memory, other external memory libraries found on the Internet, or any of the various other external sources of memory that exist on modern operating systems. You can find more information in the [Memory Allocators](http://cs341.cs.illinois.edu/coursebook/Malloc) coursebook entry.

## Malloc and C ; Chicago Blues Style

Implementing a heap allocator is a challenging assignment that has been known to rewire students' brains. For inspiration, please listen to this [Chicago Blues song](../media/malloc-blues.mp3) ([lyrics and description](../media/malloc-blues.txt)).

## A Bad Example

Memory allocation seems like a mystery, but in actuality, we are making a wrapper around the system call [`sbrk`](http://linux.die.net/man/2/sbrk). Here's a really simple implementation of `malloc`:
Expand Down
6 changes: 3 additions & 3 deletions media/malloc-blues.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Malloc Blues By Angrave (with help from ChatGPT and Suno)

Lyrics -
(Intro)
My papa said stay away from unsafe C;
Expand Down Expand Up @@ -35,9 +37,7 @@ So though my future will be more dignified
C will live forever burning me inside
for my passion remains unanswered
I'm in love with C but will it ever love me?



I'm in love with C but will it ever love me?

(Instrumental)

Expand Down

0 comments on commit 161da58

Please sign in to comment.