Language-Level Memory Management (C/C++/Rust) Questions
How specific languages expose and manage memory: pointers and references, pointer arithmetic, stack versus heap allocation, ownership and borrowing in Rust, RAII and smart pointers in C++, manual allocation and freeing in C, and garbage-collection semantics as a language feature. Covers reasoning about ownership, lifetimes, leaks, and dangling references at the language level. OS-level virtual memory and paging internals live in Operating Systems & Systems Programming.
A production C service occasionally corrupts heap memory after handling a few large requests, but you cannot reproduce it with a single test case. How would you narrow down the source of the corruption and what would you instrument first to catch it in the act?
A C struct that mirrors a binary message works on your laptop but fails on a different CPU and is larger than expected in memory. How would you reason about the struct layout before deciding whether it should be used for direct I/O parsing?
Explain the differences and typical uses of volatile, const, and restrict qualifiers in C for embedded programming. Provide examples showing how each qualifier affects compiler optimizations, code generation, and safe interaction with peripheral registers or aliasing-sensitive pointer operations.
Design a memory layout and update strategy for configuration data that must survive power cycles and support OTA updates on a device with 256KB flash and 4KB erase blocks. Optimize for minimal flash wear, atomic updates, rollback safety if power is lost during update, and integrity verification.
Explain cache associativity and set-conflict behavior and how mapping conflicts can cause pathological performance on a 4-way set-associative ARM Cortex-M7 data cache. Describe concrete layout strategies to avoid cache-line conflicts and false sharing, including padding, stride manipulation, and coloring techniques.
Unlock Full Question Bank
Get access to all Language-Level Memory Management (C/C++/Rust) interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.