A reservation that exceeds the peak memory budget

A telemetry program has a dynamic array containing 75 records in a buffer of capacity 96 slots. Each slot occupies 24 bytes. The program requests enough reserved capacity for 210 records in total; reserving storage does not change the current size.


The growth policy selects the smallest capacity in the sequence 96,192,384,…96,192,384,\ldots that meets the request. It then attempts to allocate that replacement buffer directly, without allocating the intermediate capacities.


During replacement, the entire existing buffer remains allocated until copying finishes. The combined buffer-storage budget is 10000 bytes. Ignore allocator metadata and all other storage, and assume allocation succeeds whenever this budget permits it.


The existing buffer and a candidate replacement buffer coexist during reallocation.


Find the capacity selected by the growth policy, the peak combined storage that this selection would require, and the largest replacement capacity that could fit the budget if any whole-number capacity were allowed. Give capacities in slots and storage in bytes, all as exact integers.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Dynamic Arrays Questions: