Handling MAX_CACHE_SIZE=inf in megacarbon