Reduce the contention of the memory allocator
This MR greatly simplifies the memory context and memory pools, and introduces dependency on jemalloc which also reduces inter-thread contention in the memory allocator.
Closes #2433 (closed)
Edited by Ondřej Surý