The scholars of the past emphasised keeping important things in memory. When hadith were starting to be collected and passed down, at the time of the generation after the Sahabah, it was important for people to possess a strong memory. Hadith authentication depended on that strong memory, as well as reliable writings. Here are a collection of stories regarding this.
Imam Malik narrates that once his famous teachers al-Zuhri narrated 30 hadith to them. He told al-Zuhri that he could only memorise 15 of them so could he please repeat the other 15, and al-Zuhri replied “I never asked my teachers to repeat a hadith; repeating the hadith is more heavy to me than moving a mountain.”
Hisham ibn Abdul Malik, one of the Umayyad khalifas, wanted to test al-Zuhri one day. So he called him over and said his sons wanted to learn some hadith so could he please dictate some hadith for them to write. So al-Zuhri sat and narrated 400 hadith by heart. After a month, Hisham called al-Zuhri back again and said the books they had written had gotten lost. So al-Zuhri said this was no problem and he sat and narrated the same 400 hadith again from memory, while the scribes wrote. They compared the book written then to the one a month ago and not a single letter was missing.
It was said that al-Zuhri used to put cotton in his ear in the marketplace so that he would not be corrupted by what people are saying. This way he could always keep his mind focused on the words of hadith.
Hammad ibn Zayd says Amr ibn Ubayd al-Ansari narrated to him from Abu Zu’ayzi’a who was a scribe of Marwan ibn Hakam, governor of Madina, that “One day Marwan called Abu Hurayrah and asked him his hadith and he made me go behind a curtain to write all the hadith. After 1 year he again called Abu Hurayrah and asked the same hadith in the same order and again I was hiding to write them down, and when I compared the two there was no addition, omission, or change in order.”
Abu Bakr ibn Shadhan narrates that Abu Bakr, the son of the famous Abu Dawud, came to Isfahan to visit family and the people surrounded him and asked him to narrate hadith. He he said he does not have his books with him as he came for family, but they said he should know the hadith of his father without any books. They kept elevating him until he had to narrate 30,000 hadith by memory. When he came back, the people of Baghdad told the people of Isfahan that they should rely more on his books, so they took his books back to Isfahan and compared the dictation to his writing, and they found only 6 mistakes. Abu Bakr said 3 of them were actually his teacher’s mistakes.
After relating this story to Ishaq ibn Raghaway, he was told that Amr Sha’bi never wrote down anything. Ishaq replied “Are you surprised? Because you are talking to someone who knows 70,000 hadith as if he is reading from a book.”
Al-Bukhari was told this story and replied to the person “Are you surprised by this? There is someone in this world who knows 200,000 hadith like they are written in a book”. And indeed he was only talking about himself.