# Linux Kernel Module Cheat

#### 27.2.1. malloc

Allocate memory! Vs using the stack: https://stackoverflow.com/questions/4584089/what-is-the-function-of-the-push-pop-instructions-used-on-registers-in-x86-ass/33583134#33583134

userland/c/malloc.c: `malloc` hello world: allocate two ints and use them.

Linux 5.1 / glibc 2.29 implements it with the `mmap` system call.

`malloc` leads to the infinite joys of Memory leaks.

- malloc implementation

- malloc maximum size