I think in a normally working mind these events are just stored and only recalled when you want to. But I remember a guy who had used drugs for a long time saying he also suffered this as the drugs had damaged his brain and he had no control over his thoughts. He said the drugs have opened up doorways in my mind that I cant shut. I suppose this can happen to us also when the brain become damged by something else like a virus or toxicicty.