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
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.
Step by Step Solution
3.45 Rating (161 Votes )
There are 3 Steps involved in it
Sure here is a simple C program that does this This program assumes that the heap is large enough to ... View full answer
Get step-by-step solutions from verified subject matter experts
