Some research suggests that regular use of Ecstasy (MDMA) may result in long-term memory problems, particularly in the area of prospective memory (remembering things you plan to do). It also appears that even a single dose can affect verbal memory.
Ecstasy damages mechanisms associated with serotonin, which is why long-term or heavy use can cause depression, anxiety, confusion, and difficulty sleeping.
There is also some evidence that long-term use may reduce the number of brain cells, especially in the hippocampus. Use of Ecstasy during pregnancy may damage the developing fetus, but only if taken during a particular critical period of pregnancy.
Having said that, a recent study designed to overcome the potential confounding factors in previous studies found little evidence of decreased cognitive performance in ecstasy users, with the exception of poorer strategic self-regulation (which may be a precursor rather than a consequence).