The Craziest Memory Allocation Scheme that Might Work
On Monday, I was workshop bouncing. I sat in the Internation Symposium for Memory Management a couple of times. Mostly this is people who are still worrying about the ultimate alloc()/free() scheme. I was lucky enough at one point though to hear a very provocative talk by Martin Rinard.
Martin was looking at the problem of unbounded memory growth (i.e. memory leaks, intentional or not). In short he had the gall to advocate that rather than make this dynamic, we simply replace these allocation sites with fixed size circular buffers. And if you allocate one too many... it just circles round and uses the first one. He had a charismatic way of presenting this and acknowledged that it was at this point people were usually throwing fruit.
What made it interesting though was that they had gone and modified 4 common programms (squid, pine, freeciv, and something else i can't remember) to behave this way. They ran instrumenting runs to begin with where they figured out what a good size would be for each site. And then made the switch. The results were interesting. squid "leaks" because it's cache grows unbounded, and this is actually a DOS opportunity. This scheme actually made squid work better because it validates any entry anyway, so it became an effective and bounded circular cache. A couple of status errors became a bit scrambled but Martin pointed out "it's not like they were intelligible in the first place." One of the freeciv AIs changed behavior at one point, but they couldn't tell that it played any worse, in fact, the change in personality made it harder to adapt to. The program-i-can't-remember had some problems showing large complex html files, but again, Martin's comment "are any of us really sure we read a large complex html file right anyway." These kind of evidence points went on and on.
It's an interesting way of looking at the problem. The phrase "this way programs and operating systems don't die, they just degrade gracefully" kind of summed it up. I liked the talk, not because I'd support it, but because it forced me to challenge fundamental assumptions and consider what would happen if we moved outside of them.