As a general guideline, experience points should be given at the end of every gaming session, while the DM still remembers what everyone did. If the awarding of experience points is delayed for several sessions, until the end of a given adventure, there is a chance the DM will overlook or forget what the characters did in previous gaming sessions.
Despite this risk, it isn't always practical to award experience immediately. If the player characters are still in the heart of the dungeon when the gaming session ends, wait to award points until they return to the surface. The DM can rule that characters receive experience only when they have the opportunity to rest and tell others of their exploits. This means that characters collect experience when they return to their homes, stop at an inn, or the like. Since experience is, in part, increased confidence and comprehension of their own abilities and events, the retelling of the tale boosts the ego of the characters, and this translates into experience.
Sometimes, even this rule is not applicable, however. For example, the player characters might be on a long journey through the desert and not see a settlement or friendly soul for weeks on end. In such cases, experience can be awarded after the characters have had time to reflect upon and analyze their accomplishments. This may be as short as overnight (for small experience awards) or as long as several days.
If, for whatever reason, the DM decides not to award experience points at the end of a gaming session, he should be sure to calculate and record the number of experience points each character should receive for the session and not rely on his memory.