added readMemoryPtr() API to simplify