Memory slab stats

This bases on and improves #560. It's also rebased on current master, and skips the commit which got reverted in #560.
Why yes.  I'll go back to reading school now... :)