Rework function space caching to cache on the Mesh

Rather than holding on to every function space we ever build, cache
function spaces in the Mesh they're built on.  When the mesh goes out of
scope, its cache is no longer useful since we can't build any more
function spaces that will hit it.  This change stops memory leaks in the
case of building many meshes and function spaces in the same run.
Add tests of function space caching

In particular, check that pulling things out of the cache works, and
that the cache doesn't grow unboundedly (i.e. when the meshes go out of
scope, the cache disappears).
Merge pull request #224 from firedrakeproject/fix/better_caches

Cache function spaces on the mesh they were built on.  This way, when
all references to the mesh are lost (at which point the cache becomes
useless), they are garbage collected.