fix memory leak from static cache. cleanup by removing ensureCapacity