Fixing memory consumption based instance calculation logic