Fix a cache bug, add debug helpers

The low memory condition was inverted which caused all caches to shrink
too much