---
title: "memory allocation"
type: concept
source: https://www.jemoka.com/posts/kbhmemory_allocation/
confidence: high
status: active
---

Utilization vs throughput is conflicting goals.
Big Picture OS:
creates new process sets up address space/segments read the executable, load instructions, global data libraries gets loaded Complier:
set up stack Heap Allocator: &ldquo;Sandbox of bytes&rdquo;
initialize the heap heap allocation: client void *malloc(size_t size); Returns a pointer to a block of heap memory of at least size bytes, or NULL if an error occurred.
void free(void *ptr); Frees the heap-allocated block starting at the specific address.
void *realloc(void *ptr, size_t size); Changing the size of a pointer and realloc if needed
See Heap allocator
