Clean out thread local isolated memoizations when object is garbage collected. Add global memoization support and cleanup helper methods.