There a lot of different strategies for allocating memory. Programming languages like Python or Java request their memory from the heap at runtime. Of course, C or C++ has also a heap but prefers the stack. But this are by far not so only strategies for allocating memory. You can preallocate memory at the start time of the program as a fixes block or as a pool of memory blocks. This preallocated memory can afterwards used at the runtime of your program. But the key question is. What are the pros and cons of the various strategies to allocate memory?