Fix approach #222. Optimize ThreadLocalCache to calculate the allocate size.

Optimize ThreadLocalCache to calculate the allocate size.
(This time all tests passed)