What do you mean by “Memory Management”?
In practice, memory is the largest pool of resources a programmer has to manage. In the 1960s, a computer may only have 1000-words or 2000-words of memory, and you could manage it all manually. Memory location#45 means blah, Memory location#80 means bar, etc. etc.<p>This form of variable-allocation is now done automatically (ex: int foobar; will automatically manage a memory location to be representing a 4-byte value named foobar). This is the simplest way of managing memory (even on extremely constrained modern platforms like ATTiny4, which only has 256 Bytes of RAM. BTW: I do suggest people play with microcontrollers, if only to improve your skills at programming in constrained environments).<p>But as you start having to efficiently manage more than that: a million bytes (aka: 1MB), or a billion bytes (aka: 1GB), more complex patterns arise. In particular, a program may not know how much memory it needs at compile time, and may need to shift the amount of memory usage arbitrarily upon the user&#x27;s work pattern.<p>For example: lets say you are writing a web-client, and your user is going to visit the webpage www.google.com. How much memory should you allocate for it? Well, you don&#x27;t know. You have to start downloading the page before  you even know how much memory it will use. (Upon talking to www.google.com, the Google Server says in the HTTP protocol how many bytes the webpage will take up, giving the program an opportunity to allocate memory at that point). To properly store the webpage, you need a memory-management scheme.<p>-------------<p>Modern languages have two patterns for more complex memory management like the &quot;browse to www.google.com&quot; example I described above.<p>1. C&#x27;s malloc-and-free pattern. The programmer reserves memory with malloc or calloc. And the programmer says that they&#x27;re done using the memory with free(), allowing a future malloc() call to recycle the memory.<p>2. Garbage collection, aka malloc-only. The system automatically determines when memory &quot;should be freed&quot;. Though more complex to program, its been popular even as early as the 1970s. It turns out that programmers are pretty bad at writing free() correctly in practice.<p>There&#x27;s also the &quot;automatic&quot; memory management implemented by the compiler. This is called &quot;stack allocation&quot; in most cases, and IMO is important to understand how it works... if only because of how efficiently it recycles the L1 Cache and speeds up your program. But we can talk about that some other time!