Skip to content
HN On Hacker News ↗

What garbage collection actually costs

▲ 31 points 78 comments by shivanshuag 2w ago HN discussion ↗

Pangram verdict · v3.3

We believe this text is mainly AI, with some human-written content.

95 %

AI likelihood · overall

AI
2% human-written 98% AI-generated
SEGMENTS · HUMAN 1 of 2
SEGMENTS · AI 0 of 2
WORD COUNT 141
PEAK AI % 55% · §1
Analyzed
Aug 13
backend: pangram/v3.3
Segments scanned
2 windows
avg 71 words each
Distribution
2 / 98%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 141 words · 2 segments analyzed

Human AI-generated
§1 Mixed · 55%

Every computer program needs memory. Memory is finite, so a long running program must borrow memory from the operating system when it needs it and release it once it is no longer needed. The interesting part is who reclaims that memory, and when. Some piece of code has to figure out that a piece of memory is no longer needed and release it, and figuring that out is not trivial. A value might be passed to another function, stored somewhere longer-lived, or shared across threads, and it stays needed as long as anything still refers to it.

§2 Human · 24%

If it is reclaimed early, we get memory corruption. If it is reclaimed too late, we get memory leaks. The paradigms There are two paradigms for memory management, each optimizing for different things. The first paradigm is to let the language runtime do it.