Create an example allocation and deallocation test case for heap, which allocates n chunks of memory of

Question:

Create an example allocation and deallocation test case for heap, which allocates n chunks of memory of size s, where n is size/s. Here, size is the capacity of the heap. The test case then frees every alternate chunk of memory to effectively free approximately half the heap (i.e., zeroth chunk, second chunk, fourth chunk, and so on). Finally, the test case should try to allocate a chunk of memory with size 2s.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: