InterviewLegend

Design a Memory Allocator

Signature problem
Alex Chen40 min readAdded 139 real interview reports

A memory allocator hands out pieces of a larger region and takes them back when the caller is done. The C library's malloc and free are one. Every program you've written leans on an allocator, and very few engineers have built one. Candidates report allocator asks mostly from systems, firmware and GPU-performance teams, from new grad to senior, usually in a screen or technical round and coded live in C. This shape keeps coming up, and it has been around longer than any other NVIDIA question family. The wording varies from loop to loop. A GPU-performance phone screen in October 2026 asked for an aligned malloc and its matching free in C. In September 2026, a senior PCIe-team loop wanted malloc and printf from scratch. One firmware loop in August 2026 handed over a small memory pool tracked by one 32-bit register and asked for my_malloc and my_free over it. In December 2025, one phone screen asked for allocation with no extra space and a new-grad campus round asked for a custom free() that zeroes the memory it releases. Older versions asked for fixed-size blocks in a constrained environment, or for malloc16 built on top of malloc. Below, the fixed-size pool comes first and then grows into a general allocator. Deep dive two covers the aligned version.

One detail changes the design more than it looks like it should. There's no operating system behind you. A normal malloc asks the kernel for more memory when it runs low. Here the region is all there is. Every byte of bookkeeping comes out of that region or out of fixed static memory, and running out is an ordinary result you hand back to the caller as NULL.

The NVIDIA angle
NVIDIA loops that use this prompt lean hard on C internals. The September 2026 PCIe-team loop that asked for malloc and printf also covered spinlocks, interrupt handlers and paging. Ask which version you're getting before you write a line: a fixed-size pool, or a general malloc with alignment.

NVIDIAPremium lesson · System design round

The NVIDIA design, worked end to end.

  1. The API and data modelSystem design · Signature problem
  2. The design, drawn out2 diagrams
  3. 4 deep divesWith the tradeoffs
Get the NVIDIA questions

$49 a year · all 108 companies · instant access

139 NVIDIA interview reports · guide updated

NVIDIA interview guide

Know what NVIDIA asks before you walk in.

19 coding · 5 system design · 25 behavioral questions

Get Premium$49 a year · Instant access
Or start freeNo card.

Get their questions first.

Had your NVIDIA interview?How we research

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.