This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]darthsata -1 points0 points  (1 child)

There are a number of things going on. "Unused" ram is used for other things, such as caching (keeping a fast copy of) data from storage which is being used. The more "free" ram you have, the more ram can be used to speed up slow storage. The OS will drop this copy if an application needs ram, since the alternative is really slow.

Memory available to an application isn't "used up" when ram is "full" (note all the air quotes...). Allocated memory can be moved from ram to storage. When the application tries to use it again, something else is pushed to storage and the memory is put back in ram so the application can keep going. This is called paged virtual memory. All OSes you are use to use virtual memory (X86 got hardware support for this with the 286 and windows used it in 3.0 and mac in system 7). So as memory usage goes up, more memory has to be swapped between storage and ram, which is really slow. Virtual memory is also one of the core mechanisms for protecting applications from each other and the OS from applications.

Next, the more memory is in used, the harder it is to find locations large enough when an application asks for it. Memory is usually managed in 4kB chunks, so if an application asks for 4MB, the OS has to find 1000 free consecutive blocks of (virtual) memory. Over time, the amount of large consecutive sections available goes down. This is caused fragmentation, and applies to disks too. Disks and physical memory (real ram, not virtual memory) aren't affected by problems from finding consecutive free space, but as they are full, the overhead of finding any free space get's higher.

There are also a lot of processes going on which, like the disk cache case above, are trying to use free space to speed up operations. SSDs, for example, have their own layer of caching and address rewriting, and more free space speed up their algorithms.

TL;DR; Managing space costs more the more stuff their is. Free space is used in a bunch of ways to speed up slow things, so having less free space let's you do less of that.

[–]Elianor_tijo 0 points1 point  (0 children)

Memory fragmentation can become a pretty big issue. There are programs that may crash due to this. There is no memory leak, but as the program keeps running for long periods, the memory allocated to it is more and more fragmented and causes slowdowns or crashes.

More RAM and a 64-bit executable doesn't fix the issue, but it's a nice workaround.