Add functions isMemoryValid and isObject