Jesus is living under threat. As he is sitting at supper, a woman approaches him with a jar filled with an expensive ointment. She breaks the jar and anoints his head with the ointment. When Israel had kings, they had been anointed by prophets (See 1 Samuel 16; 1 Kings 19:16). The word we translate as "Messiah" means anointed.
The other dinner guests do not do this scriptural exegesis. They don't think, "She must be a prophet. Ergo, he must be a king." Rather, they focus on what seems to them to be the foolish waste. And the contents of the jar were expensive--almost a year's pay.
Jesus reminds them of what they surely already knew--they are going to have many opportunities to use resources in what seems to be the right way--taking care of the poor. After all, the poor are not going away. Circumstances will continue to foster poverty.
Jesus points out to them that what this woman has done in this place on this day is is to prepare his body for burial. Yes, kings were anointed, but also are those persons who are to be buried.
The irony in Mark's version is that Jesus then says that wherever the good news is proclaimed in the whole world, what this woman has done will be told in remembrance of her. Yet, Mark doesn't tell us her name.