Is it true that a set is compact iff it is closed, bounded, and has finite measure? I'm sure that this holds for $\mathbb{R}^n$ and for $L^p$ spaces.  Is it true in general?

Here’s a counterexample. For $A\subseteq\Bbb N$ let $\mu(A)=\sum_{n\in A}2^{-n}$, and for $m,n\in\Bbb N$ let $$d(m,n)=\begin{cases}1,&\text{if }m\ne n\\0,&\text{if }m=n\end{cases}\;.$$
Then $\langle\Bbb N,d\rangle$ is a metric space of diameter $1$ with the discrete topology, so all subsets of $\Bbb N$ are bounded and closed. $\langle\Bbb N,\wp(\Bbb N),\mu\rangle$ is a measure space in which every measurable set has finite measure. Thus, every $A\subseteq\Bbb N$ is closed, bounded, and of finite measure, but only the finite sets are compact.
