NVIDIA interview question

Create a memory management system that allocates fixed-size blocks, in a constrained environment with limited memory. Avoid using malloc, free, new, or delete; instead, rely on a 'memory' function for both managing memory and allocating space for clients.

Interview Answer

Anonymous

30 Nov 2023

The only acceptable solution is constant time and constant space. You have to use empty blocks as linked list nodes. When freeing a block append a new node to list, when allocating take a node from list.

1