mozilla/rust — pull request #12809 by eddyb (2014-03-10 14:06:32+00:00)
Title: Use a TypedArena in ty::ctxt.

**NOTE**: rebased on top of #12735 to make this easier.
**NOTE2**: not easy at all, ended up in a refactoring party, the good parts should go into #12735 while the bad parts should be solved by #12807 and a fix for #3598 that is in the pipeline, AFAIK.
I advise looking away from the universal lifetime variance bypass hack that is `.borrow()`, while it still exists.
**Results**: Sadly, the trans peak is high at **1.5GB** (but I encourage more tests, I somehow doubt #12770 and this can actually increase memory usage significantly) - *however*, the LLVM flatline is around **850MB** (almost **300MB** less), so that's promising.
**Special mentions**: this was inspired by seeing a LLVM flatline of **~600MB** when running rustc with jemalloc (each type's `t_box_` is allocated on the heap, creating a lot of fragmentation, which jemalloc can deal with, unlike glibc).