Our teacher, the Beit Yosef, wrote in Orach Chaim there, and this is his wording: It seems to me that these things were only said according to their custom, for they used to go to eulogize their dead in the middle of the year to arouse weeping and wailing, as that pain is not forgotten for thirty days. But what is practiced in this time, that at the completion of the year they eulogize and mention his soul—even according to the words of Shmuel it is permitted, etc., for on the contrary, their intention is to conclude their mourning through this, etc. Thus far his words. And according to this, the matter is simple that our mentionings, where the sheliach tzibbur says "El Malei Rachamim"—there is no concern in this at all, for behold, even on the last festival they mention souls. And so too on all the Sabbaths of the year, except when they bless the New Moon, for this is a prayer and they vow charity for them. And so too they do not mention souls when there is a brit milah or a groom. And only on the Sabbath before Shavuot and before Tisha B'Av, even though they bless the month and there is also a milah and a groom—they mention souls because then was the intensity of the decrees in ancient times. And they also say "Av HaRachamim" for this reason. And all this depends on custom (see Ba'er Heitev).
וכתב רבינו הבית יוסף באורח חיים שם, וזה לשונו: ונראה לי שלא נאמרו דברים הללו אלא לפי מנהגם, שהיו הולכים להספיד מתיהם באמצע השנה לעורר בכי ויללה, שאותו הצער לא נשכח עד שלושים יום. אבל מה שנוהגים בזמן הזה, בתשלום השנה סופדים ומזכירים נשמתו – אף לדברי שמואל שרי וכו' דאדרבא דעתם להפסיק על ידי כך אבלותם כו' עד כאן לשונו. ולפי זה הדבר פשוט שהזכרות שלנו, שהשליח ציבור אומר "אל מלא רחמים" – אין בזה חשש כלל, שהרי גם ברגל האחרון מזכירים נשמות. וכן בכל שבתות השנה, לבד כשמברכים ראש חודש, דזהו תפילה ונודרים לצדקה בעדם. וכן אין מזכירים נשמות כשיש ברית מילה או חתן. ורק בשבת שלפני שבועות ולפני תשעה באב, אף שמברכים החודש וגם יש מילה וחתן – מזכירים נשמות מפני שאז היה תוקף הגזרות בזמן הקדמון. ואומרים גם "אב הרחמים" מטעם זה. וכל זה תלוי במנהג (עיין באר היטב).