There are potentially a few things happening here.
When a computer runs out of available RAM it starts swapping or paging data out of RAM to files on your hard disk. When your Mac was previously saying that it was using 3.98GB of 4GB it could also potentially have had a lot more data loaded but part of it swapped out to your hard drive. You can find these swapfiles on your Mac in /var/vm
called swapfile0
and swapfile1
, etc. Similar to Windows where you'll find a file called pagefile.sys
, typically in the root of the C drive. If your Mac is actively storing data in swapfiles you'll see the amount that is being used listed in Activity Monitor as "Swap Used".
Compressed memory is a newer concept where the operating system tries to get the most out of physical memory by compressing the least-recently-used contents of RAM before resorting to paging out, but it can only go so far. Once it can't compress anything else it'll start paging out to swapfiles.
Another thing that could be happening that might explain why your upgraded machine is sitting at 7.5GB of 8GB used, is that once you close applications and files the operating system doesn't immediately release that space in RAM. It'll store that data in a file cache, until it needs to use that space for something else, so that if you decide to open the same files again it can open them almost instantly. You can see this in action where you start up your Mac and it takes maybe five-ten seconds to launch an application the first time, but if you close it and open it a second time it opens much much faster, because that data was never released from RAM. You can also see the size of the "File Cache" value listed in Activity Monitor. So it could be that 5GB of your RAM is the stuff you are actually using right now, and 2.5GB is stuff that you were using recently and your Mac is keeping handy just in case.
There is more going on with memory management than just these things, but these are the ones that I think most likely explain what you're seeing. Chances are before the upgrade you Macbook was using more than 4GB because some data was paged out to swapfiles, and now your Macbook could be actually using less than 8GB but using up the free space with a file cache that allows it to quickly reopen things you recently closed.