# Mittos memory management > - [Mittos64 documentation chapter 9](https://github.com/thomasloven/mittos64/blob/master/doc/9_Memory_Management.md) ## Address translation The upper half of the virtual memory space is reserved for kernel use - i.e everything above `0xFFFFFF8000000000`. Since the 64 bit address space is many orders or magnitude larger than any physical memory Mittos is likely to ever encounter, all available memory is mapped into this space in a one-to-one translation. I.e. physical memory at `0x123000` is mapped into `0xFFFFFF8000123000`. This allows the kernel direct access to any page in memory which simplifies all memory operations. See [XXX] for a more detailed explanation of this approach. The kernel virtual memory manager contains functions for mapping individual pages in a recursive four level page directory. The memory area above `0xFFFFFFC000000000` is used for dynamic allocation of memory for the kernel. I.e. `0xFFFFFFC000000000` is the kernel `brk`. Furthermore `0xFFFFFFC010000000` is set aside for kernel `mmap` calls to facilitate larger allocations by musl malloc. ## Physical memory management Physical memory is handled on a page-by-page basis. I.e. only single page blocks can be allocated or freed. When a page is freed it is put on the top of a stack and a pointer to the next page is written to it. Thus the pages themselves form the stack structure. On boot this stack is filled by pages from the multiboot memory map with some checks to make sure pages that are used by the kernel or boot data is not freed prematurely. ## Relevant files - `src/kernel/memory/memory.c` - `src/kernel/include/memory.h` - `src/kernel/vmm.c` - `src/kernel/pmm.c`