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

1 Expert Approved Answer
Step: 1 Unlock

Sure here is a simple C program that does this This program assumes that the heap is large enough to ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related An Experiential Introduction To Principles Of Programming Languages Questions!