Fix potential signed overflow in string hashing
Simplify object memory allocation