A nanoscale analysis method to reveal oxygen exchange between environment, oxide, and electrodes in ReRAM devices