FIX #2332: avoid overflow on 64-bit machines in the memory allocator