If you look in table 8 in the document in this link it does indicate that the 2951 512 memory can be replaced by a 2 gig memory. If you do the upgrade I believe that the router will automatically recognize the new memory and you do not need to configure anything for it.
http://www.cisco.com/c/en/us/products/collateral/routers/1900-series-integrated-services-routers-isr/ordering_guide_c07_557736.html
HTH
Rick
HTH
Rick