Fix miscalculating large memory allocations.
am: 158f084de4

Change-Id: Ia59570d18cbea711529e93c3424bf4689c0979fd