Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Human brain is two separate organs, Stanford Medicine-led research finds(stanford.edu ↗)
    28comments
  2. San Francisco Onion Futures Company(onionfutures.com ↗)
    53comments
  3. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    9comments
  4. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    369comments
  5. GPT-6 Astra Solves a WWI German Radio Cipher(prinzai.com ↗)
    discuss
  6. Typesafe-computer-use drives a Mac toward a goal for 1/50th of a cent per step(github.com/awlevin ↗)
    22comments
  7. SDCC – Small Device C Compiler(sourceforge.net ↗)
    15comments
  8. Science Is Open Software(jepedersen.dk ↗)
    26comments
  9. Cloudflare Quick Tunnels(cloudflare.com ↗)
    275comments
  10. Saving another 100TB of RAM(cloudflare.com ↗)
    64comments
  11. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    24comments
  12. NASA-IBM Lunar Foundation open-Source Geospatial AI Model(usra.edu ↗)
    1comments
  13. How to Write with an LLM(sockpuppet.org ↗)
    316comments
  14. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    77comments
  15. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    6comments
  16. Ctenophores: Wonders of Biology(quantamagazine.org ↗)
    4comments
  17. Goroutine Leak Profiles(go.dev ↗)
    2comments
  18. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    90comments
  19. Veronese's Dogs(publicdomainreview.org ↗)
    discuss
  20. OpenJev(openjev.com ↗)
    257comments
  21. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    87comments
  22. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    66comments
  23. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    12comments
  24. Stepfun Step 5 Preview (LLM): On AA Pareto frontier(artificialanalysis.ai ↗)
    1comments
  25. The Farnese letter(simonklee.dk ↗)
    6comments
  26. Minimal Phone 2(minimalcompany.com ↗)
    212comments
  27. Xcode 27.1 Beta Release Notes(developer.apple.com ↗)
    96comments
  28. Cyclomatic Complexity in C#(ndepend.com ↗)
    18comments
  29. Inside ZCode: Silently uploading your Git history to the cloud(ferstar.org ↗)
    97comments
  30. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    49comments

Goroutine Leak Profiles

24 pointsby 2d agogo.dev
2 comments
2h agoHN ↗

I'm coming predominately from other languages, so it took me a hot minute to figure out what the various bug were.

• channels are by default "unbuffered", in that a send needs a waiting recv to actually do the send, and blocks until such. The addition of the buffer prevents the block & permits the goroutine to progress (and eventually exit, and thus, not leak) … so long as the buffer is sufficiently large enough.

• channels do not, AFAICT, realize when the receiver is gone, and will block indefinitely even when there is no receiver. (It is the same "chan" object, I think, in both sender/receiver / there is no distinction. So, the single object is never GC'd.)

• goroutines are not GC'd. (& the code doesn't/can't hold like, a reference or a handle to a goroutine / there is no "join" primitive.)

1h agoHN ↗

(2) has a bit more nuance to it: you can close channels… but the langage is designed for that to only be ok on single senders, a receiver can gracefully handle a closed channel (an iteration will just stop, a receive can use the 2-valued form to get the information), a sender will always straight up panic. Aka go channels are designed for fan-out.

And not closing channels is also considered idiomatic, per a tour of go:

Channels aren't like files; you don't usually need to close them.