Basically LabVIEW will do this automatically.
However in some cases you need to ensure the code makes it clear that you want a part of the code/data to be released from memory; if e.g. you have a function you're not using all the time then you might want to call it dynamically and then close all references to it afterwards. When all references is closed LabVIEW "understands" that it can release the memory used for that function and does so automatically.
There used to be a choice in the options dialog that would deallocate all memory asap, in LV7 it's been removed and replaced with a Request deallocation function found on the Advanced-> Data Manipulation palette.The old way of doing it would typically slow your application down significantly because it would deal
locate memory that you more often than not would have been better off having allocated and ready for use...The LV7 function gives you a bit more control.
Check out the performance part of the LV manual...it will tell you a lot of good stuff about how LabVIEW use memory - in many cases an understanding of that will improve the performance and memory usage of your application enormously.