question about advertised route and memory

Hello,
i have about 3m routes on my route tables so i want advertise them to a peer , now my question is when i advertise these routes to a peer they take memory ? or only when i receive route from a peer it makes my memory busy ?
thank you.