The Rambam, of blessed memory, wrote in chapter 22: The law of hekdesh, the law of the poor, and the law of vows is not like the law of an ordinary person. For if a person said, "Whatever my animal gives birth to shall be hekdesh for the upkeep of the Temple," or "shall be forbidden to me," or "shall be given to tzedakah," even though it does not become sanctified because it is not yet in the world, he is nevertheless obligated to fulfill his word, as it is said, "he shall do according to all that proceeds from his mouth." Since this is the case, if a person gave instructions when he was a shekhiv mera and said, "Whatever this tree produces shall be for the poor," or "the rent of this house shall be for the poor," the poor have acquired them. Thus far his words. For since the vow takes effect upon him and it is a mitzvah to fulfill his words, the lien takes effect upon his property and the heirs must pay [the creditor], and it is as if he transferred ownership of the house to the poor until they receive the rent, and likewise he transferred the tree to them until they receive the fruits, and his sons do not inherit from him until they first fulfill the vow [Sma].
And there are some of our teachers who disagree with the Rambam on two matters. First, that a vow does not take effect until he takes it upon himself, such as if he said, "When my animal gives birth," or "this tree produces fruit," or "the rent of this house, I will give it to hekdesh or to the poor," it is a vow because he took it upon himself by saying "I will give it." But when he said "it shall be hekdesh," or "they shall be for the poor," or "it shall be given," or "you shall give," neither hekdesh nor tzedakah have acquired it, for a person cannot sanctify a thing that is not yet in the world, and he did not take the vow upon himself but rather said that it should be so or commanded to do so, and this is not a vow and his words are void. Second, even when he said "I will give it," which is a vow, this is only when the one who vowed is alive; but if he died, it is nothing, for there is no person here upon whom the vow is incumbent, and his property is not liened for his vow unless the fulfillment of the vow was during his lifetime, such as if during his lifetime the tree produced the fruit or the rent of the house already existed such that the tenant was obligated to pay the rental fee. But when he died before they came into the world, there is no one upon whom the vow can take effect [ibid.].
Our teacher, the Rema, wrote that this opinion is primary, and so it is proper to rule. According to this, a shekhiv mera who gives his instructions and wants to leave for tzedakah the profit from houses, shops, and money, should say: "I hereby sanctify to the poor" or "to such-and-such tzedakah the house or the shop or the money for their fruits," for this is a valid acquisition even for a healthy person, and the poor or the hekdesh have acquired it. For on account of a vow, there is no place for it to take effect according to this opinion when the taking effect of the vow was after his death, unless it took effect during his lifetime, for then his property became obligated. Therefore, when he said "I will give a maneh from my property" or "such-and-such object" or "such-and-such land," the vow takes effect immediately since they are in the world. And all the more so when he said "a maneh of my property shall be for so-and-so" or "such-and-such object" or "such-and-such land shall be for so-and-so," that so-and-so acquired it immediately since the thing is in existence. And if he swore to fulfill the sale or the gift, it has been explained in siman 209, see there.
And when he sanctified a debt that he has against another, that when it is paid he will give it to hekdesh, it is also a thing that is not yet in the world, and it is like fruit from a tree and depends on his wording: if he said "I will give it" and it was collected in his lifetime, the vow takes effect and his property became liened as has been written [Shach]. And if there is a collateral for the debt or a guarantee on the property of the debtor that he can collect from them in the courts, it appears to me that the vow takes effect during his lifetime, for the vow has a place to take effect. And we have already explained in siman 209 that money for fruits is like a palm tree for its fruits, and see what I wrote at the end of siman 66.
כתב הרמב"ם ז"ל בפכ"ב דין ההקדש ודין העניים ודין הנדרים אינו כדין הדיוט שאלו אמר אדם כל מה שתלד בהמתי יהיה הקדש לבדק הבית או יהיה אסור עלי או ינתן לצדקה אע"פ שאינו מתקדש לפי שאינו בעולם הרי זה חייב לקיים דברו שנאמר ככל היוצא מפיו יעשה והואיל והדבר כן אם צוה אדם כשהוא שכ"מ ואמר כל מה שיוציא אילן זה לעניים או שכר בית זה לעניים זכו בהם העניים עכ"ל דכיון דחל עליו הנדר ומצוה לקיים דבריו חל השיעבוד על נכסיו והיורשים לשלם [ב"ח] והוה כאלו הקנה הבית לעניים עד שיקבלו השכירות וכן האילן הקנה להם עד שיקבלו הפירות ואין בניו יורשים אותו עד שיקיימו תחלה את הנדר [סמ"ע] ויש מרבותינו שחולקים על הרמב"ם בשני דברים האחד דאין נדר חל עד שיקבלו על עצמו כגון שאמר כשתלד בהמתי או אילן זה יוציא פירות או שכר דירת בית זה אתננו להקדש או לעניים הוי נדר מפני שקבל על עצמו שאמר אתננו אבל כשאמר יהיה הקדש או יהיו לעניים או ינתן או תתנו לא קנו לא ההקדש ולא הצדקה דאין אדם מקדיש דבר שלב"ל ועל עצמו לא קבל הנדר אלא אמר שיהיה כן או צוה לעשות כן ואין זה נדר ודבריו בטלים והשנית אפילו כשאמר אתננו דהוה נדר אין זה רק כשהנודר קיים אבל אם מת אינו כלום שהרי אין כאן בן שהנדר מוטל עליו ואין נכסיו משתעבדים לנדרו אלא כשקיום הנדר היה בחייו כגון שבחייו הוציא האילן את הפירות או שכבר היתה שכירות הבית שהשוכר חייב ליתן דמי דירה אבל כשמת קודם שבאו לעולם אין על מי לחול הנדר [שם] ורבינו הרמ"א כתב שסברא זו עיקר וכן ראוי להורות ולפ"ז שכיב מרע המצוה צוואתו ורוצה להניח לצדקה הריוח מבתים וחנויות ומעות יאמר הנני מקדיש לעניים או לצדקה פלונית את הבית או החנות או המעות לפירותיהם דהוי קנין גם בבריא וקנו העניים או ההקדש ומפני נדר אין מקום לחול לפי דיעה זו כשחלות הנדר היתה לאחר מותו אא"כ חל בחייו דאז נתחייבו נכסיו ולכן כשאמר אתן מנה מנכסיי או חפץ פלוני או קרקע פלונית חל הנדר מיד כיון שהם בעולם וכ"ש כשאמר מנה מנכסיי יהיה לפלוני או חפץ פלוני או קרקע פלונית יהיה לפלוני דזכה אותו פלוני מיד כיון שהדבר בעין ואם נשבע לקיים המקח או המתנה נתבאר בסי' ר"ט ע"ש וכשהקדיש חוב שיש לו על אחר שכשיפרע יתננו להקדש הוה ג"כ דבר שלב"ל והוה כמו פירות מאילן ותלוי בלשונו אם אמר אתננו ונגבה בחייו חל הנדר ונשתעבדו נכסיו כמ"ש [ש"ך] ואם יש משכון על החוב או אחריות על נכסי הלוה שיכול לגבות מהם בערכאות נ"ל דחל הנדר מחיים דיש להנדר מקום לחול וכבר בארנו בסי' ר"ט דמעות לפירות הוי כדקל לפירותיו ועמ"ש בס"ס ס"ו: