Loading...
Loading...
Browse 11 real-world technical and behavioral interview questions about Memory. Review scenarios, edge cases, and architectural best practices.
Object-dtype string columns hold pointers to individual Python objects rather than packed bytes, any missing value promotes an integer column to float64, and the parser's peak exceeds the final frame. Declare dtypes, select columns, use categoricals, and prefer a columnar file.
The GC segregates the heap into generations on the assumption that most objects die young, collecting gen0 often and gen2 rarely, with large objects on a separate heap that is not compacted by default. Allocating less means removing boxing and using Span<T> over pooled or stack memory.
The kernel kills you on everything in the cgroup, while the GC only reports the managed heap. Committed-but-empty heap, per-core Server GC heaps, thread stacks, native buffers and loaded code all count against the limit and none of them appear in a heap size figure.
Push the work into a whole-column operation so the interpreter is entered once instead of once per row, replace chained indexing with a single .loc assignment, and move to DuckDB, Polars or a cluster once the frame plus its intermediate copies stop fitting in memory.
Span is a stack-only view over memory you already have, so slicing it costs nothing while Substring allocates a new string and copies. It removes allocations rather than making them faster, which is the right lever in a runtime where the cost is collection pressure rather than the allocation itself.
Node.js stream backpressure prevents a fast producer from filling memory while a slow consumer catches up. The core signal is write() returning false and the producer waiting for drain before sending more.
Take a heap profile and compare two taken minutes apart, because the shape of the growth tells you whether it is a leak, a cache with no bound, or simply the collector letting the heap grow. The two real knobs are GOGC and GOMEMLIMIT, and reducing allocation matters more in Go than in a generational runtime.
C# value types store data directly and copy on assignment, while reference types store references to heap objects. Nullable reference types are compile-time flow-analysis warnings, not runtime null guarantees. It also connects structs to the point an interviewer is testing.
Go slice append either extends the existing backing array or allocates a new one when capacity is exhausted. Bugs appear when two slices share the same array and one append mutates data the other still observes.
A generator produces items on demand and keeps only the current item plus its suspended frame, so memory stays flat as the input grows; it is the wrong tool when you need a length, indexing, or more than one pass, and when per-item resume overhead outweighs the space saved.
CPython frees an object the instant its reference count reaches zero, so steady growth is usually something still holding a reference rather than a leak. The cycle collector reclaims only reference cycles. Measure with tracemalloc first, then use __slots__ or generators to cut per-object and peak cost.