mref.lua: to simulate the mem ref