adding memory instrumentation code to memread