Hacker News with Generative AI: Memory Management

How ZGC allocates memory for the Java heap (joelsiks.com)
This post explores how ZGC, one of the garbage collectors in the OpenJDK, allocates memory for the Java heap, focusing on enhancements introduced in JDK-8350441 with the Mapped Cache. A garbage collector does much more than just collect garbage - and that’s what I want to unpack in this post. Whether you’re a Java nerd yearning for details, a GC enthusiast, or just curious about how ZGC uses memory behind the scenes, this deep dive is for you.
Understanding Memory Management, Part 5: Fighting with Rust (educatedguesswork.org)
This is the fifth post in my planned multipart series on memory management. You will probably want to go back and read Part I, which covers C, parts II and III, which cover C++, and part IV, which introduces Rust memory management. In part IV, we got through the basics of Rust memory management up through smart pointers. In this post I want to look at some of the gymnastics you need to engage in to do serious work in Rust.
Understanding Memory Management, Part 5: Fighting with Rust (educatedguesswork.org)
This is the fifth post in my planned multipart series on memory management. You will probably want to go back and read Part I, which covers C, parts II and III, which cover C++, and part IV, which introduces Rust memory management. In part IV, we got through the basics of Rust memory management up through smart pointers. In this post I want to look at some of the gymnastics you need to engage in to do serious work in Rust.
WebAssembly: How to Allocate Your Allocator (nullprogram.com)
An early, small hurdle diving into WebAssembly was allocating my allocator. On a server or desktop with virtual memory, the allocator asks the operating system to map fresh pages into its address space (sbrk, anonymous mmap, VirtualAlloc), which it then dynamically allocates to different purposes. In an embedded context, dynamic allocation memory is typically a fixed, static region chosen at link time.
Pahole: Analysing Memory Layout of Complex Data Structures with Ease (pramodkumbhar.com)
Sunday, 5th November 2023: Putting together this blog post feels like a positive stride! As I mentioned in the previous post, (core-to-core latency tool), I'm aiming to integrate more consistent writing into my routine. While it took a month to pen this down, it's progress from the previous year 😇. Hoping that the upward trend will continue...!
Avoiding memory fragmentation in Rust with jemalloc (kerkour.com)
Battle of the Mallocators (blogspot.com)
If you use RocksDB and want to avoid OOM then use jemalloc or tcmalloc and avoid glibc malloc. That was true in 2015 and remains true in 2025 (see here).
Mistakes and cool things to do with arena allocators (zylinski.se)
When programming in Odin you can use arena allocators. If you use an arena allocator combined with a dynamic array, then there are a couple of pitfalls that may not be apparent at first. Let’s look at what arenas are, how you can run into trouble when naively using them with dynamic arrays and what you can do instead.
Golang sync.Pool is not a silver bullet (wundergraph.com)
When it comes to performance optimization in Go, sync.Pool often appears as a tempting solution. It promises to reduce memory allocations and garbage collection pressure by reusing objects. But is it always the right choice? Let's dive deep into this fascinating topic.
Implementing a spellchecker on 64 kB of RAM in 70s led to compression algorithm (pcgamer.com)
Understanding Memory Management, Part 4: Rust Ownership and Borrowing (educatedguesswork.org)
This is the fourth post in my planned multipart series on memory management. Part I covers the basics of memory allocation and how it works in C, and parts II and III covered the basics of C++ memory management, including RAII and smart pointers.
Vramfs: Vram Based Filesystem for Linux (github.com/Overv)
Unused RAM is wasted RAM, so why not put some of that VRAM in your graphics card to work?
Damon Self-Tuned Memory Tiering Shows Nice Improvement for Linux Servers (phoronix.com)
Linux developer SeongJae Park has posted a set of patches for the Linux kernel's wonderful DAMON code to provide for self-tuned memory tiering that "just works" and is racking up some nice performance wins.
Stupid Smart Pointers in C (kevinalbs.com)
Managing memory in C is difficult and error prone. C++ solves this with smart pointers like std::unique_ptr and std::shared_ptr. This article demonstrates a proof-of-concept (aka stupid) smart pointer in C with very little code. Along the way we'll look at the layout of the 32-bit x86 call stack and write assembly in a C program.
Understanding Memory Management, Part 3: C++ Smart Pointers (educatedguesswork.org)
This is the third post in my planned multipart series on memory management. In part I we covered the basics of memory allocation and how it works in C, and in part II we covered the basics of C++ memory management, including the RAII idiom for memory management. In this post, we'll be looking at a powerful technique called "smart pointers" that lets you use RAII-style idioms but for pointers rather than objects.
Understanding Memory Management, Part 2: C++ and RAII (educatedguesswork.org)
This is the second post in my planned multipart[1] series on memory management. In part I we covered the basics of memory allocation and how it works in C, where the programmer is responsible for manually allocating and freeing memory. In this post, we'll start looking at memory management in C++, which provides a number of much fancier affordances.
The case of the vanishing CPU: A Linux kernel debugging story (clickhouse.com)
A mysterious CPU spike in ClickHouse Cloud on GCP led to months of debugging, revealing a deeper issue within the Linux kernel’s memory management.
Zig: A good memory allocator in 200 lines of code (github.com/ziglang)
An allocator that is designed for ReleaseFast optimization mode, with multi-threading enabled.
A good memory allocator in 200 lines of code (github.com/ziglang)
An allocator that is designed for ReleaseFast optimization mode, with multi-threading enabled.
Pro .NET Memory Management 2nd Edition (minidump.net)
Let’s take a short break from writing a GC, to talk about Pro .NET Memory Management 2nd Edition. I’m usually not one to self-promote, but I keep being asked when the book will be out, so clearly we haven’t communicated enough about it. Here we go.
Subverting Control with Weak References (jlongster.com)
Weak references are neat. The best language features unlock different kinds of abstractions, and weak references do exactly that. Let me show you why.
Memory Hell (trynova.dev)
For a JavaScript engine, a garbage collector is one of those things one wishes one could avoid but simply cannot.
Neut Programming Language (vekatze.github.io)
Neut is a functional programming language with static memory management.
When allocators are hoarding your precious memory (2021) (algolia.com)
While switching to the latest trendy framework or language has become somewhat of a cliché in the engineering world, there are times when upgrading is warranted and necessary.
If C++ cmpler became smarter would't be opinionated as rust borrowchecker? (ycombinator.com)
I'm not well versed with either language as I was reading the article published https://cacm.acm.org/blogcacm/21st-century-c/<p>I suddenly thought of the forward looking trajectory of the idea of making c++ compiler smart(er) as to ease the burden of memory copying (section 3) with zero overhead. If one traces this arc it means that one day c++ compilers would be equivalent to the borrow checker?
TIL: Rust does not prevent memory leaks (ycombinator.com)
I'm not a Rust developer so I have no clues about what Rust does, how it does or why it is the way it is.<p>I had a short interaction on another thread and some user told that Rust does not prevent memory leaks.<p>People talk so much about Rust memory safety and how everything must be rewritten in Rust, but if Rust does not prevent memory leaks why are people so crazy about it?
Rust Memory Management Explained (infoworld.com)
Rust's ownership and borrowing mechanisms guarantee memory safety at runtime. Here's how to use them in your programs.
JEP draft: 4-byte Object Headers (Experimental (openjdk.org)
Reduce the size of object headers in the HotSpot JVM from between 64 and 128 bits down to 32 bits on 64-bit architectures. This will reduce heap size, improve deployment density, and increase data locality.
The inevitability of the borrow checker (yorickpeterse.com)
When defining a type in Inko, it's allocated on the heap by default.
The Inevitability of the Borrow Checker (yorickpeterse.com)
When defining a type in Inko, it's allocated on the heap by default.