OS X does a quite decent job of memory management, but it's not perfect. OS X is responsible for memory management (unloading RAM and disk cache contents), and proper memory management is crucial in ensuring your machine is running smoothly.
When you run programs and do other activities on your computer, content of different sorts gets loaded into the RAM and disk caches, and when you quit a running program, all that loaded content should be purged from memory. If you've been around computers long enough, you've probably heard the phrase ' have you tried turning it off and on again?' This trick usually works because it forces your computer to empty out the contents of its RAM and disk caches when you restart.