python
14 minPython Runtime Advanced: Native Memory, ASGI Lifecycles, and Worker Failure
Debug memory outside Python objects, choose ASGI worker boundaries, and find silent hangs in background consumers.
Loading page...
python
14 minDebug memory outside Python objects, choose ASGI worker boundaries, and find silent hangs in background consumers.
Q&A
Q&ANative stack memory, scheduling overhead, context switching, and file descriptors can be exhausted.
Each platform thread consumes native resources, including stack reservation, and excessive runnable threads add scheduling and context-switching overhead. The service may hit native-thread creation errors or degrade before that point. Bound executors, measure queue depth and task latency, and apply backpressure rather than creating one thread per unbounded unit of work.
unix
9 minSeparate resolver configuration, caching, search domains, authoritative records, and application-level DNS behavior.
java
9 minBuild the mental model behind happens-before, volatile fields, monitors, and safely publishing objects between threads.
Q&A
Q&ACompare post-GC live-set size and object retention paths over time.
High allocation can cause frequent collections while post-GC occupancy remains broadly stable. A leak tends to retain objects that should have become unreachable, so compare heap dumps and dominator paths across time. Check allocation rate, live set, GC logs, and process/container memory together before changing heap settings.
java
8 minTrace plugin and application class loaders from long-lived roots before blaming metaspace.
Q&A
Q&AIn Python 3, map returns an iterator that computes values as it is consumed.
Python 3 map is lazy: it returns an iterator and evaluates each mapped value as the iterator advances. Convert it to a list only when you need materialized results or repeated traversal. Lazy evaluation saves memory but exceptions may occur later when a consumer iterates.
Q&A
Q&Aepoll tracks interest and reports readiness changes instead of requiring repeated full-set scans.
select requires rebuilding and scanning descriptor sets on each wait and has platform-specific descriptor limits; poll also examines a supplied list. epoll maintains kernel-side interest and ready structures, which suits large mostly-idle sets. It does not remove per-connection memory costs, application scheduling, or edge-triggered drain requirements.