new method to calculate memory check