Atlas · Details
Allocation Styles
Author’s note
This is a gargantuan post, but I enjoyed re-reading it in 2026. It views programmers and programming languages through the lens of how they think about allocating memory as they work. It turns out to be astoundingly nuanced, and sits at the center of language design, programming styles, and expressiveness/resilience tradeoffs.
The post is not for the faint of heart. You probably have to be a hardcore programming languages nerd in order to make it to the end.
AI Notes
A taxonomy Steve admits he invented over the weekend, posted for his Amazon coworkers before the paint was dry: the names are provisional, he isn't sure whether the last two styles are actually distinct, and he confesses he has never used STL, so readers are asked to write in and tell him where it belongs. The looseness is part of the appeal. Half of what he is documenting is sociology rather than software: allocation style as tribal identity, the machismo that keeps C programmers proudly twiddling bits (a farmer-dog-chicken-grain puzzle gets solved in raw bit masks to show how that life feels), buffer-and-pointer fluency as the only currency some interviewers will accept, and a cameo from the five years Steve spent at a company whose entire codebase — OS, libraries, applications, many of the tools — was 80x86 assembly.
One warning about the shape: the bottom four styles get the full guided tour, then the top two get a hurried sketch before Steve declares himself out of time and returns to his day job, which that week had him slogging through buffers and indices, a joke he makes at his own expense. The detours are where the essay pays for its length. Mid-tour he abruptly answers a question that had bugged him for years about why schools still teach linear and quadratic probing for hashtables, and his autopsy of the Java Iterator ("a poor-man's collection") will land with anyone who was writing collections code in 2005.
Related listings
-
2005
Is Weak Typing Strong Enough?
Same drunken-rant move applied to a different axis. Weak Typing is about the type system you inherit from your first language; Allocation Styles is about the memory model. Both end with the same advice: stop confusing your first idiom for the right one.
-
2006
Math For Programmers
A year later on the Blogspot side, Steve makes the parallel argument for math literacy — climb as high as you can and step back down only when you must. Same shape of argument, different dimension.
-
2005
Lisp Wins (I Think)
The Lisp piece is the practical sequel — once you accept that you should program as high as the problem allows, Lisp is the rung that keeps refusing to be displaced.
From the peanut gallery
Read the rest of the thread · 4 more
-
"Hardware is expensive, people are cheap."
The modern thought in most companies is the opposite. It appears that you are speaking tongue-in-cheek, so my comment is probably redundant.
In the end thanks to Taiwan and other countries, hardware is often the cheapest part of any business.
-
Yes, it was tongue-in-cheek. Although I was speaking on behalf of all the people at Amazon using C++, because obviously they feel that hardware is indeed the gating resource. That, or they don't realize how much trouble they're giving themselves for no good reason.
-
Clearly you and me talk to different people. Most definitely everyone near me considers that people and our ability to actually get things _done_ with those people (think 6 hours builds) is the gating "resource" here. Hardware is cheap, plentiful and while not an excuse for bad code, we have gotten more in trouble for not delivering, or delivering buggy code, than delivering slow code.
-
Well... my feeling is that Java is the best solution out there today. Our support for it at Amazon isn't ideal yet, but the gains you get by switching to Java far outweigh any Amazon-specific build or deployment difficulties you'll encounter.
I also like Ruby a lot, and it wouldn't surprise me in the least to see Ruby become a viable language for a great many production tasks.
Personally, I think C++ doesn't really have a place in server-side software development today. I'd use C (or D) for anything truly and demonstrably performance-critical *and* for which you could make some financial case that Java isn't capable of performing well enough. And I'd use Java or higher-level languages for everything else. But that's just my opinion, and this is just a blog...
"But that's just my opinion, and this is just a blog..."
Don't let me get you down. :)
Actually I agree with you here. I like C++ a lot, for the problem areas where it's suited. But I actually turned to an office-mate the other day and said "why do we use C++ for our services, anyway?"
When I first got here, 8 months ago, I assumed that services were written in C++ because the service layer was a bottleneck in the critical path. But when I think about the services that our team owns, they're all database-bound. All C++ has going for it in this space is inertia.
— Josh H · April 22, 2005 09:06 PM