Fix integer overflow corner case on memory calculation

Signed-off-by: Albert Chu <chu11@llnl.gov>