There are two episodes that suggest that the Doctor’s does not have perfect recall. 

Season 3 episode 4 *The Swarm* deals with the doctor’s program degrading due to the memories and subroutines added over the 2 years it’s been active. His program deteriorates and he cannot even remember who Kes is.

But there is a later episode that deals more significantly with the doctor’s memory, season 5 episode 11 *Latent Image*, in which the doctor’s memory of an event 18 months ago has been blocked from him. There is a scene that tells us a bit about how the doctor’s memory works.

It comes after he has realised that he performed a procedure on Harry Kim that he does not remember, and goes to Seven for help. Someone erases his memory of the last hour in an attempt to keep him from investigating further:

> **EMH:** Let's have a look at my program.
> 
>**Seven:** A deletion in your short term memory buffer.
>
>**EMH:** Our chat in Astrometrics never got filed. That's why I can't remember it.

So this tells us that his program has a short term memory buffer that is processed in some way and then “filed” into long term storage.

Later in the same scene, Seven helps him access his memories of the event:

> **Seven:** I've isolated your memory files from stardate 50979.
>
> **EMH:** They weren't deleted? 
> 
> **Seven:** No.
> 
> **EMH:** Then why can't I remember them? 
> 
> **Seven:** The program was rewritten to deny you access to those memories. I'm trying to restore them.

And later:
 
> **Seven:** The files are difficult to localise. The memories will be out of sequence.

This scene establishes that his long term memory is not optimised for “replay”, but, similar to our own memory, optimised for some other form of recall. The changes in his recall during *The Swarm* reinforce this idea.

Compare this to Data, whose memory was unable to be altered, even by himself, in the *TNG* episode S4E14 *Clues*, and thus he had to be ordered to keep a secret.