We've all had this experience. We walk into a room intending to perform some task there, but once we have entered the room, we suddenly can't remember what the task was we intended to do or why we entered the room in the first place.
The article linked below offers an interesting psychological theory as to why this happens.
From the article:
" …some forms of memory seem to be optimized to keep information ready-to-hand until its shelf life expires, and then purge that information in favor of new stuff … (and) … walking through a doorway is a good time to purge because whatever happened in the old room is likely less relevant now …"(I thought this was worth posting since in the past when I personally had this experience I sometimes wondered if it was a sign of some developing memory problem. Apparently not, and we can be reassured that it is indeed just a normal memory function).
www.scientificamerican.com/article/why-walking-through-doorway-makes-you-forget/