When you say memory you probably mean conscious memory. It has its benefits, it is always easier to know that you know something rather than discovering that you know it, but it is not essential. It is possible to remember something, or rather to know it, without knowing that you know that. In the following I will make the distinction between "remembering" (consciously) and "knowing" (unconsciously).
For mathematics you probably need to know more than you need to remember. If you know the basic definitions and how to derive from them, you will invariably be able to prove things. If you remember how it may be easier to do that, and probably easier to explain to others.
Surely remembering things is helpful, very helpful. I had friends in my undergrad who remembered everything and had the wonderful ability to connect all mathematics together and they got amazing grades and knew everything. I staggered to comprehend most things, and had a hard time fully understanding things (now I know that this is only so because we only had so little set theory in undergrad studies).
In fact, if you allow me a bit of namedropping, Saharon Shelah has an incredible memory for his results. The man has written a thousand papers and he remembers the results from each paper in the most uncanny way. I once asked him about something and he immediately knew to direct me to this and that, and added that in another paper I can also find more.
On the other hand, to do mathematics one has to be able to prove things, and to come up with new ideas. It does not matter how do you come up with them, you just have to be able to justify it mathematically. To see the large picture, even if you don't understand it consciously (or don't remember it consciously), is important and useful.
I believe that this is as subjective as humanly possible, and there is no proper way of analyzing whether or not memory is important, but I don't think anyone can argue that it is not useful. Every person has its own process, and where some people would be upset for not remembering everything; others won't mind and would focus on actually working. I know this because I don't remember too much outside of set theory, and even in set theory I don't remember too much - just references to results, and sometimes not even the actual results (only something close enough).
What I think is important is to have a good "proximity" alarm set, so when you run into a result which looks familiar you could remember it exists somewhere before, even if you don't remember the exact results which triggered that familiarity.