Why is it necessary to irreversibly erase a memory? I know that the most accepted resolution of the Maxwell's demon paradox was proposed by Landauer and revolves around the fact that the demon's memory is finite and will have to be erased at some point. This is an irreversible process that will generate entropy and preserves the second law.
My question is this: why is it necessary that the demon erases it's memory instead of just writing over it in a reversible way. Couldn't the part of the machine responsible for writing a new state in memory be made to depend on the previous state in memory? Or is memory necessarly linked to an irreversible process?
 A: To be a reversible process, information must be preserved - by definition: you cannot reverse something, i.e. put things back to the way they were before it happened, if you've lost some of the information describing how things used to be.
As the demon decreases the entropy, it has to keep tabs on which chamber each molecule is in so it doesn't let one go back the other way. Thus it needs to make a new one-bit entry in its memory (chamber "A" or chamber "B") for that molecule-passage event. But its memory is necessarily finite, so there will come a time there is no more space for any new records. Once the memory has now exhausted all bits, there is no other place to put the new information. Reversibility would mean you can move information around in memory (i.e. shuffle around the records of what molecules went where), but you can't put anything new to make for this new molecule. To put something new, you have to throw information out of memory - into the Universe, which means it becomes lost, and the process is irreversible as you now no longer have a bit of information you need to put things (the demon and boxes) back to the way they were before. Or, you have to ignore any new molecules, meaning either the demon will not be manning the door anymore or it will have to start doing something stupid like start flipping it back and forth at random, and entropy will cease to decrease.
You thus cannot "write over it reversibly" because the information that was there before that write has to still be there, somewhere else in the system, for you to be able to reverse the write. With a finite memory capacity that is smaller than the capacity of the thermodynamic system, that is not possible. Eventually, whatever "auxiliary" store you may be using, even though you did not call it "memory", will fill up, and then you are left with either cessation of the demon's job or with irreversibility (ejection of information into the outside Universe) as the only two possible choices.
A: Empty computer memory can be viewed as a thermal reservoir at zero temperature. In a very real sense it is possible to convert information (or rather, in this case, absence of entropy) into energy, something that has been experimentally demonstrated. So the initially empty memory can be viewed as a finite reservoir that allows the demon to "produce" energy by interacting with the gas, moving a bit of gas entropy into the memory. But once it is used up, the demon cannot reversibly restore it since that would need it to dump the stored entropy somewhere colder, and it does not have access to any such thermal reservoir. 
