  We propose a simple yet efficient mechanism for passive error correction in
topological quantum memories. Our scheme relies on driven-dissipative ancilla
systems which couple to local excitations (anyons) and make them "sink" in
energy, with no required interaction among ancillae or anyons. Through this
process, anyons created by some thermal environment end up trapped in potential
"trenches" that they themselves generate, which can be interpreted as a "memory
foam" for anyons. This self-trapping mechanism provides an energy barrier for
anyon propagation, and removes entropy from the memory by favoring anyon
recombination over anyon separation (responsible for memory errors). We
demonstrate that our scheme leads to an exponential increase of the
memory-coherence time with system size $L$, up to an upper bound
$L_\mathrm{max}$ which can increase exponentially with $\Delta/T$, where $T$ is
the temperature and $\Delta$ is some energy scale defined by potential
trenches. This results in a double exponential increase of the memory time with
$\Delta/T$, which greatly improves over the Arrhenius (single-exponential)
scaling found in typical quantum memories.
