Explore tens of thousands of sets crafted by our community.
Memory Allocation Strategies
12
Flashcards
0/12
Static Allocation
Memory is allocated at compile time and the allocation does not change at runtime. It is used for global and static variables.
Stack Allocation
Memory is allocated and de-allocated in a last-in, first-out order, typically for local variables within functions.
Heap Allocation
Memory is dynamically allocated at runtime and requires explicit deallocation. It is flexible but can lead to fragmentation.
Garbage Collection
Automatic reclamation of memory that is no longer referenced by the program, reducing the need for explicit deallocation.
Reference Counting
Each object has a count of the number of references to it, and when the count reaches zero, the object can be deallocated.
Region-based Memory Management
Memory is allocated from a region (also called an arena) where all objects within have the same lifetime and are deallocated simultaneously.
Buddy System Allocation
Memory is divided into power-of-two sized blocks. Buddies are blocks of the same size and are split/combined to accommodate memory requests.
Slab Allocation
A memory management scheme meant for objects of fixed size where slabs are pre-allocated chunks of memory meant to hold a specific type of object.
Pooling
A type of memory management where a pool of memory objects is maintained and reused for efficient allocation and deallocation.
Escaping Analysis
Compiler optimization technique that determines if a variable can be allocated on the stack, because it does not escape the function scope where it is used.
Subdivision
Dividing memory into blocks of various sizes to fit different allocation requests, aiming to reduce wastage and fragmentation.
Segmentation
Memory is divided into segments based on the logical division of code, such as functions, data, objects, etc., allowing non-contiguous allocation.
© Hypatia.Tech. 2024 All rights reserved.