Lets look at two of the companions of the Messenger of Allah (peace and blessings be upon him)
Abu Hurayrah (r.a.) and 'Abdullah bin 'Amr (r.a.)
(from the book 'Anecdotes from Hadith' by M. Atiqul Haque)
It is an established fact the the Prophet (s.a.w.) had asked his companions not to write down any of his sayings but rather to concentrate writing down the Qur'an in order to avoid any misquotation or addition. The companions did not dare write down any Ahadith from the Prophet (s.a.w), several of them however began memorizing the Ahadith. At a later date, when there was no danger of any mistakes being made in the recording of the Qur'an, some of the companions obtained special permission to write down the Ahadith lest the Ummah be deprived of that which the Prophet (s.a.w.) left for them. Anas (r.a.) Abu Hurayrah (r.a.) and Abdullah bin Amr (r.a.) were among these specialists.
Abu Hurayrah (r.a.) began to commit everything to memory he had learned from the Prophet (s.a.w). He said he divided the night into three parts. One part he set aside for sleep, one for prayer and the other for memorising the hadith. Then he began to write down the hadith for fear of forgetting them. He also occasionally used to read out his notes to the Prophet (s.a.w) to ensure that the wording was correct, and in this way he had his work validated by the Prophet (s.a.w) himself.
Abu Hurayrah (r.a.) also used to say ''No other Companion can claim to have commited to memory as many Ahadith as i have, except for Abdullah bin Amr, who used to write down his hadith from the very beginning, whereas i did not do that from the beginning.''
The number of Ahadith narrated by Abu Hurayrah (r.a.) was 5374.
Abu Hurayrah (r.a.) narrated '' I once told the Prophet (s.a.w) ''O Rasullullah, i hear so many hadith from you but i cannot remember them. The Prophet (s.a.w.) asked me to spread out my cloak, which I did. He then plunged his clenched hand inside the cloak (as if offering something), and asked me to clasp it to my chest. I did so and after this, i never forgot anything.'' (al-Bukhari)
Abu Hurayrah (r.a.) also narrated another similar event: ''Once the Prophet (s.a.w) told me with regards to a particular speech he gave, that the man who spread his cloak over his body, then clasped it to his chest, would never forget that speech. I immediately spread my cloak over my body, and when he had finished his speech, i clasped it to my chest. Truly i have never forgotten a word of that speech.'' (Al Bukhari)
Imam al Bukhari narrated that the Governor Marwan once wanted to test the memory of the Prophet's companion, Abu Hurayrah (r.a.), so he invited him to apper before him and narrate a number of Ahadith. As he narrated, Marwan's secretary copied down every hadith, word by word and line by line. A year later Marwan invited Abu Hurayrah (r.a.) back again and urged him to repeat all the hadith which he had narrated on the previous occasion. Marwan's secretary was hiding, checking Abu Hurayrah's recitation with the Ahadith he had copied down the year before. Abu Hurayrah narrated all the hadith, one by one, without the alteration of a single letter, and was attested by the secretary.
'Abdullah bin 'Amr (r.a.) who wrote down more than 5384 Ahadith after having directly heard them from the Prophet (s.a.w) compiled all his Ahadith in a volume called Sadiqa. One day he asked the Prophet (s.a.w.) if he should write down everything he heard from him, regardless of the circumstances. Having replied in the affirmative, the Prophet (s.a.w.) pointed to his two lips and said that under no circumstances could an untruth emerge from betwwen his lips (Al Bukhari)