Memory allocation is a process by which computer programs and services are assigned with physical or virtual memory space.
Memory allocation is the process of reserving a partial or complete portion of computer memory for the execution of programs and processes. Memory allocation is achieved through a process known as memory management.
Memory allocation is primarily a computer hardware operation but is managed through operating system and software applications. Memory allocation process is quite similar in physical and virtual memory management. Programs and services are assigned with a specific memory as per their requirements when they are executed. Once the program has finished its operation or is idle, the memory is released and allocated to another program or merged within the primary memory.
Memory allocation has two core types;
Static Memory Allocation: The program is allocated memory at compile time.
Dynamic Memory Allocation: The programs are allocated with memory at run time.