frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

How ZGC allocates memory for the Java heap

https://joelsiks.com/posts/zgc-heap-memory-allocation/
86•lichtenberger•1y ago

Comments

gopalv•1y ago
The 32x virtual memory to physical memory ratio plays into relocation and colored pointers (i.e pointers where some bits serve as flag bits).

Putting the actual data layouts in 44 bits out of 64 is a neat trick which relies on the allocator being aware of the mappings between physical and virtual addresses.

twoodfin•1y ago
When your comment and the article refer to “physical” addresses, those are physical in the context of the JVM, right? To the OS they’re virtual addresses in the JVM process space?
acchow•1y ago
Correct. ZGC has no way to escape from the virtualization by the kernel (assuming your hardware and kernel uses an MMU)
MBCook•1y ago
Thank you for the answer, I was wondering that as well.
hinkley•1y ago
In the beginning of the 32 bit revolution, when the future was here but unevenly distributed, there was a lot of talk about how 32 bit pointers would fundamentally change how people wrote code. Among other things it got rid of a bunch of odd bookkeeping, and if you don’t have to do the bookkeeping you don’t have to write the code in a way that supports it, so you can do other things.

Not too long after someone asked what sort of interesting changes 64 bit will bring. And I’ve been keeping that question in the back of my mind ever since.

Aliasing memory multiple times in order to do read or write barriers and make GC much cheaper is a pretty good one. But another one I know of is that one of the secrets of the L4 microkernel is that its IPC speed comes substantially from reducing the amount of TLB work that needs to be done to switch to another process running in a different address space. They use the same address space and only swap out the access rights which cuts the call overhead in half. It’s pretty easy to put a bunch of processes into a 64 bit address space and just throw each one a randomly located 4GB slice of RAM.

twoodfin•1y ago
Yeah, would love to see the CPU vendors invent some primitives to let user code pull those kinds of privilege isolation tricks within a single process and address space.

Something like: “From now on, code on these pages can only access data on these pages, and only return to/call into other code through these gates…”

hinkley•1y ago
Thread based seems like it at least should be possible.
ahartmetz•1y ago
I've had some ideas about avoiding format validation in IPC receivers if the data is encoded by trusted code, which is also the only code that has rights to send the IPC data / to connect to the receiver. I can't really think of an important problem that it would solve, though. DBus always validates received data, but it's not really meant or very suitable for large amounts of data anyway.
pron•1y ago
For relevant upcoming changes see Automatic Heap Sizing for ZGC: https://openjdk.org/jeps/8329758
twoodfin•1y ago
What I’m looking for is a way for a process to de/re-escalate its privileges to access memory, without an expensive context switch being required at the transition. The CPU would simply enforce different rules based on (say) the high-order bits of the instruction pointer.

Imagine a server process that wants to run some elaborate third-party content parser. It’d be great to be sure that no matter how buggy or malicious that code, it can’t leak the TLS keys.

Today, high-security architectures must use process isolation to achieve this kind of architectural guarantee, but even finely tuned IPC like L4’s is an order of magnitude slower than a predictable jump.

gpderetta•1y ago
For a brief moment Intel supported MPX which did something similar.

You can also play tricks with the virtualization hardware, bit it need kernel support.

Eventually we will get segments back again.

MarkSweep•1y ago
That would be pretty cool. Something like the Win32 function GetWriteWatch, but implemented in hardware instead of the page fault handler (I assume).

https://learn.microsoft.com/en-us/windows/win32/api/memoryap...

Or some sort of special write barrier store op-code, idk.

mike_hearn•1y ago
It exists, that's called MPKs.
twoodfin•1y ago
I don’t think MPK’s will fit the need I have. Simply: Run some arbitrary, untrusted, non-sandboxed code in the same thread with assurance it can’t read page X. When that code completes and I’m back in code I trust, X is readable again.

Is that something MPK makes possible? The doc I’ve read suggests either your process can flip permission bits or it can’t. Great for avoiding out-of-sandbox reads. But if there’s arbitrary execution happening, why can’t that code flip the access to secrets back on?

mike_hearn•1y ago
Oracle Labs has tech that does that:

https://youtu.be/T05FI93MBI8?si=EieFgujaGiW2gbO8&t=958

The trick is to do a cascading disassembly of all untrusted code you'll execute to prove it can't change the MPK register.

twoodfin•1y ago
Wow. Neat trick and exactly the kind of thing I was looking for.

Thanks!

EDIT: Looks like this is the relevant paper from the Graal team: https://www.graalvm.org/resources/articles/binsweep.pdf

jdougan•1y ago
Is that something like the memory protection scheme on the Newton OS?
nyanpasu64•1y ago
Isn't not swapping page tables during a call precisely what the KPTI mitigations had to turn off for Meltdown mitigations?

Whistle: Speech to Text in 16.9 MB

https://cactuscompute.com/blog/whistle
638•gmays•11h ago•138 comments

Reducing undefined behavior in the C language

https://lwn.net/Articles/1095811/
53•signa11•2h ago•28 comments

Keyboard differences between Windows and Macs

https://unsung.aresluna.org/deeper-dive-keyboard-differences-between-windows-and-macs/
37•sohkamyung•1h ago•23 comments

Theranos.world

https://www.theranos.world/
351•kbyatnal•11h ago•126 comments

Man discovers his parents' coffee machine used 1TB of data in 10 days

https://www.dexerto.com/entertainment/man-discovers-his-parents-coffee-machine-used-1tb-of-data-i...
519•ck2•1d ago•326 comments

I hired an illustrator to draw my house. Now it's my Home Assistant dashboard

https://antonfrolov.substack.com/p/i-hired-an-illustrator-to-draw-my
484•soheilpro•2d ago•84 comments

Yes, and

https://htmx.org/essays/yes-and/
278•Michelangelo11•19h ago•81 comments

Why isn't the industry freaking out about DeepSeek 4.1 Flash?

https://www.dgt.is/blog/2026-10-07-deepseek-freek-out/
511•jonotime•1d ago•432 comments

The value of not getting to the point (2015)

https://ken.arneson.name/2015/11/the-value-of-not-getting-to-the-point/
138•NaOH•9h ago•46 comments

AI-ready biological data: $1.8B global commitment

https://biohub.org/news/virtual-biology-initiative-expansion/
97•ray__•8h ago•14 comments

ADHD as a circadian rhythm disorder: evidence and implications for chronotherapy (2025)

https://www.frontiersin.org/journals/psychiatry/articles/10.3389/fpsyt.2025.1697900/full
220•bookofjoe•8h ago•142 comments

ETH-68: Ethernet Audio Interface for Linux

https://naturalsystems.io/eth68
117•chabad360•1d ago•66 comments

Beauty in DVD Menus

https://vale.rocks/posts/dvd-menus
281•speckx•15h ago•153 comments

Ask HN: What do you run on a $5 VPS that's worth keeping online 24/7?

153•mariocesar•2d ago•250 comments

Bevy 0.20

https://bevy.org/news/bevy-0-20/
103•Philpax•5h ago•17 comments

Step 5 Preview, a 1M-context MoE from StepFun, shows up on OpenRouter

https://openrouter.ai/stepfun/step-5-preview
117•AnneWodell•12h ago•26 comments

DuckDB Ducklake

https://github.com/duckdb/ducklake
146•saikatsg•1d ago•19 comments

A 5.3M-year-old deep-sea whale necropolis in the Diamantina Zone

https://www.nature.com/articles/s41586-026-10546-z
110•bryanrasmussen•1d ago•7 comments

Show HN: Edi Life OS – self-hosted life dashboard with an MCP server for AI

https://github.com/edrisranjbar/lifeos
29•edris0077•4h ago•6 comments

Show HN: Making a flexible "neon" t-shirt with LED filaments

http://scottbezek.blogspot.com/2026/10/making-flexible-neon-t-shirt-with-leds.html
133•scottbez1•12h ago•27 comments

A Terminal Protocol for Program Status (OSC 7501)

https://mitchellh.com/writing/program-status-osc7501
123•mfiguiere•2d ago•40 comments

Show HN: Jevman – AI decision models play Pac-Man

https://opper.ai/jevman-benchmark/
48•felix089•12h ago•7 comments

Scaling and benchmarking a critical message bus using a new indexing strategy

https://blog.janestreet.com/scaling-and-benchmarking-a-critical-message-bus/
30•eatonphil•11h ago•1 comments

Orkut.com

https://orkut.com/
163•andreynering•14h ago•122 comments

Archaeologists Are Reconstructing the 'Invisible' Technologies of the Stone Age

https://www.smithsonianmag.com/science-nature/archaeologists-are-reconstructing-the-invisible-tec...
119•Hooke•1d ago•51 comments

The Slow Formation of Durable Software

https://newsletter.dancohen.org/archive/the-slow-formation-of-durable-software/
276•benbreen•2d ago•113 comments

US man given prison sentence for bot-farming music streams

https://thequietus.com/news/us-man-given-prison-sentence-for-bot-farming-music-streams/
148•cdrnsf•1d ago•235 comments

OpenAI withdraws three mathematical results

https://twitter.com/danintheory/status/2108065033070789090
265•sashank_1509•21h ago•552 comments

The dawn of the age of the exoskeleton

https://theconversation.com/the-dawn-of-the-age-of-the-exoskeleton-281804
69•speckx•1d ago•39 comments

15-year search for a band that charted once and vanished

https://shahidhussain.com/writing/search-for-salvage/
356•shahidhussain•4d ago•127 comments