A memory wipe was a method that was used to selectively or completely erase the memory of a droid. It was an act sometimes performed on unwitting droids by dregs and criminals. After Cad Bane had kidnapped and ransacked the memory of C-3PO and R2-D2 for information on the Senate Building's layout, he only had the incident wiped from their memories to avoid having any suspicion falling on him.
Shortly after the Galactic Empire was formed, Bail Organa, in order to protect Princess Leia, had C-3PO's memory wiped clean in order for the droid to not spill any confidential information, especially information related to Leia's true lineage, which would make her a target of the Emperor. When he purchased C-3PO and R2-D2, Owen Lars also wanted the droids' memories wiped after he learned they were looking for Obi-Wan Kenobi. C-3PO's memories were (against his own wishes) wiped again on Kijimi when the droidsmith Babu Frik bypassed C-3PO's programming restrictions to allow the droid to translate the Sith writings on a Sith dagger. C-3PO's photoreceptors turned red while he translated the forbidden inscriptions. After completing the translation C-3PO rebooted, and his memory was wiped in the process, leaving him to restart with his basic factory programming.
Memory wipes were an important process, and the lack of one could allow droids to develop new ideas. This happened with the mining droid STALKER-1, who turned into a hunter after years without a memory reset. Memory wipes were far from perfect, however, and both C-3PO and the First Order droid O-MR1 both experienced flashes of erased memories. A macro protocol could be used to wipe the memories of multiple droids simultaneously.
Droid memories could be backed up externally and then restored to a droid following a memory wipe. After C-3PO's second memory wipe, it turned out that R2-D2 had backed up C-3PO's memories to the point where Rey had undertaken her first mission for the Resistance. R2-D2 was able to restore his counterpart's memories from that backup.
During the Clone Wars it was standard protocol of the Galactic Republic for astromech droids to receive a memory wipe following every mission, in order to prevent classified information from falling into Separatist hands. Anakin Skywalker ignored this procedure in regards to R2-D2, to the chagrin of both the Jedi Council and the Republic Military leadership.
The Galactic Empire did not grant its droids any independence and sought to keep them subservient and docile. Part of this process was frequent memory wipes in order to keep them from getting independent notions. The First Order, a successor group to the Empire, felt the same way and followed the same basic practice.
Just as with droids, it was possible for computers, such as those controlling starships, to develop personality quirks if they did not undergo memory wipes. After having to deal the quirks of the on-board computer of Poe Dameron's T-70 X-wing starfighter, Black One, the BB-series astromech droid BB-8 felt that it needed a memory wipe.
The Galactic Empire also implemented a similar technique on personal, as well as the First Order, with Reconditioning, on stormtroopers whose "programming" was deemed erratic or faulty.
- LEGO Star Wars: Droid Tales Episodes I-III