Mountain Lion Memory - is it improved in management?

Discussion in 'OS X Mountain Lion (10.8)' started by iOrbit, Jul 17, 2012.

  1. iOrbit macrumors 6502a

    Mar 8, 2012
    when i use lion, (8Gb of ram) i regularly have to free memory myself. if i do not, then inactive memory builds, pageouts build, virtual memory increases, all while 'free memory' dwindles down to less than 100mb, the system will not think to free memory, it only free's memory when i quit the whole application. (closing tabs/windows, etc does not seem to free it)

    this is a terrible experience on normal hdd's, has anyone noticed a difference on mountain lion , particularly people not using ssd drives?

    pleas, this is very important for me, as i'v been considering reverting to windows :(
  2. SpyderBite macrumors 65816


    Oct 4, 2011
    I haven't had any of these problems in Lion on my 2012 13" mbp with 16gb. I wonder if its your hardware rather than the OS?
  3. east85 macrumors 65816


    Jun 24, 2010
    I haven't really noticed more memory in particular (as I didn't monitor lion), but everything running much quicker would suggest that it's managed better. I didn't even do a fresh install either, coming from Lion.
  4. tkermit macrumors 68040


    Feb 20, 2004
    Apple certainly advertised improved "Virtual Memory performance" on one of the WWDC12 keynote address slides.
  5. SlCKB0Y, Jul 17, 2012
    Last edited: Jul 17, 2012

    SlCKB0Y macrumors 68040


    Feb 25, 2012
    Sydney, Australia
    OS X considers that unused RAM is wasted RAM, much in the way that Linux does, and so it will try and cache/buffer as much stuff as possible in order to boost system performance. Once RAM is required these buffers are made available to the system. This is generally a good thing.

    You need to provide more information that this.

    The most important thing we need to know which is not mentioned is - are you actually experiencing performance issues or are you just watching your memory stats?

    If you do actually have performance issues, let us know what all the resource usage stats are at.

    * What are your page outs AND page ins (OS X will on occasion page out even if you have free RAM available, this is intended so the ratio is more important than the raw number).

    * Inactive memory is technically free memory, but what level is this at?

    * What software are you running and how many instances? What activities are you general doing on your computer?

    Virtual memory is not even a metric you should be looking at as it is completely meaningless in this context. Swap used is more relevant.
  6. nuckinfutz macrumors 603


    Jul 3, 2002
    Middle Earth
    Very informative Sickb0y

    Thank you.

    I never really thought about the concept of "Free RAM is wasted RAM" but it makes total sense. You've got to power the memory anyways so you may as well use it.
  7. SlCKB0Y macrumors 68040


    Feb 25, 2012
    Sydney, Australia
    Well the idea is that you should never need to do this - the OS will do this for you. Once you are out of actual free RAM, the OS will release the "inactive memory" as required.

    I have seen the original posters comments before made by other people but I've personally not experienced it (even when running Lion of 2GB). I also know how the memory management *should* work.
  8. iOrbit thread starter macrumors 6502a

    Mar 8, 2012
    im tired having to monitor my system and grab screenshots. i'v seen this answer several times before, but it simply doesn't ring true for performance.

    os x doesnt do what its supposed to do,

    once i am with no free memory left, it does not free the inactive ram, instead it goes to page outs, and everything becomes absolutely awful.

    if it was managing properly, it would 'use the inactive memory' but id doesnt, it let it become terrible, like a system with no more memory.

    i always run app store, mail, safari, address book, ical, itunes, iphoto and sometimes imovie.

    in addition i will run steam (which is a memory leaker its self)

    other times i wil run photoshop cs5

    iv found so many discussions on google with people who seem to know what they are talking about more, and backing up my experience. i don't know why others dont experience it, is it the way they use their machine? ssds? faults in ours? i dont know.

    photoshop working with a file with quite a few layers at 6000 pixel images, will eat up to 2.5 gigs of ram.

    steam up to a gig or even a little more.

    generally though, my system can run my apps with 4 gigs or even nearly 5 gigs ram free when they are opened.

    its after using them for awhile that all free memory is finished and is then described as inactive memory, which is never freed unless apps are quit.

    fi i dont purge, then i cant get my memory back without quitting all or restarting.
  9. SlCKB0Y macrumors 68040


    Feb 25, 2012
    Sydney, Australia
    Using only terms like "absolutely awful" and "terrible" is akin to talking to a doctor and telling him you "feel sick" and expecting him to know what is going on.

    When this happens, what do you actually experience?

    Are you seeing system lag? beach balls? etc.
  10. Runt888 macrumors 6502a

    Nov 17, 2008
    If your apps are using or leaking large amounts of memory, that memory isn't inactive or free, and the os doesn't have anything it can do about it other than start swapping to virtual memory.
  11. PurrBall macrumors 65816


    Oct 25, 2007
    I'm running 10.8 GM and just had my system screech to a halt with 20 MB free ram and nearly 4 GB inactive. It was just constantly swapping and useless. Apple still has a bit of work to do.
  12. VinegarTasters, Jul 18, 2012
    Last edited: Jul 18, 2012

    VinegarTasters macrumors 6502


    Nov 20, 2007
    Ram problems and speed in Lion/mountain lion

    The reason that Lion and Mountain Lion is slower/more memory hog than snow leopard is probably because they are moving more and more pieces into a virtual machine. Everyone knows that Java is very slow and a memory hog. Comparing Java to C++, Java takes 10 times more memory to run. It needs that memory because of the virtual machine. Average slowness is 2 times slower to 10 times slower (comparing Java and C/C++). If in C it can be even faster.

    If you have a game that is 30 frames per second in C/C++ (most games are: investigate console games), it will usually be 15 frames per second to 3 frames per second in Java or C# or any interpreted language (including python). This makes the games unplayable. That is why most action games don't exist on Android, while there are a lot of hardcore 3D games on iOS. It is because of the virtual memory and interpreted code.

    If Apple is going the same route, you should expect 2 to 10 times longer to do average things compared to earlier operating system versions. These things usually show up in code that spend a lot of time in loops, like permutation through items, or main game engine loop.

    Of course, Apple is not using Java, but their support of LLVM probably led them to CLang and its LLVM technology that actually does everything Java does... compiling into bytecode first (IR in LLVM terms). java runs the bytecode by interpreting them in a virtual machine. You can execute IR in a virtual machine, or try to recompile it into native code, but it usually requires external libraries that support the IR, which means supporting the same bloat in java. So you will get garbage collectors that grabs whole chunks of memory and index and frees themselves on its own terms (usually when it runs out of memory instead of immediately). Sometimes to save themselves trouble, they will just leave it in IR and run a JIT when needed (just in time compiling). Since Leopard, the OpenGL has this slow layer! Why do you think games on Mac are so slow compared to Windows on same hardware. I think people should investigate it deeper and let the truth out on why all of a sudden it takes all the memory and runs so slow, it is pointing towards virtual machines.
  13. Nozuka macrumors 68020

    Jul 3, 2012
    You should probably try to do a clean install of ML when it is released instead of an update. Just to make sure its not related to your installation.
    You can always go back to your old installation through a backup if it still happens.
  14. SlCKB0Y, Jul 18, 2012
    Last edited: Jul 18, 2012

    SlCKB0Y macrumors 68040


    Feb 25, 2012
    Sydney, Australia
    I do not know where to start with the misinformation in this post.

    Are you trolling? I honestly can't tell.

    Firstly, there are plenty of 3D intensive games on Android.


    Secondly, most of these games are almost entirely coded in c or c++, with a very small Java wrapper.

    *face palm*
    One word. Drivers.
  15. VinegarTasters macrumors 6502


    Nov 20, 2007
    If it is the drivers, note that nvidia provides drivers for both windows and osx. On same machine with same game, the Windows version runs with faster framerate.

    The opengl layer requiring a virtual machine JIT compilation is common knowledge:

    For Android, if java was not slow, why did they have to code the whole thing in C/C++ for every 3D game? It is BECAUSE Java is so slow and a memory
    hog. It is simply a C/C++ program, but forced into a slow Java wrappers.

    It would not run in plain java because it would be 3 to 15 frames per second.

    The main problem with C/C++ in Java is that you would have to port your program for EVERY device instead of porting it once, to account for the differences in each android device. Instead of drivers API handling that done by the OS, you are doing the operating system's job, which is just plain stupid. No developer has time to do operating systems work. Look how much time and money microsoft and others spend to make sure programs can run on any hardware. Java and android is pushing this job to the developers.
  16. Runt888 macrumors 6502a

    Nov 17, 2008
    JIT and virtual machines are not mutually inclusive - specific parts of the OpenGL pipeline are optimized at run time, but they are not using a virtual machine in the way you seem to think they are.

    Also, LLVM is used to optimize and increase performance. Just because the "VM" part used to stand for virtual machine, you seem to think that means "slow."

    From Wikipedia:
    You're spouting so much nonsense it's hard to even read it, let alone take you seriously.
  17. sammich macrumors 601


    Sep 26, 2006
  18. SlCKB0Y macrumors 68040


    Feb 25, 2012
    Sydney, Australia
    I never claimed Java was fast. I know it is relatively slow when compared to a lower level language like c/c++. I was taking issue with your claim that there were no GFX intensive games on Android because all Android Apps are pure Java. There are MANY games of this type and they DO NOT use java to do the heavy lifting.

    Huh? What are you even talking about? Firstly, the main reason Google implemented the NDK and support for c/c++ other than speed was to allow quicker ports as game devs are likely to have their game on other platforms in these languages.


    Also, the NDK/APIs can handle a lot of the stuff you are talking about.

    Did you even read the NDK documentation?


    This ^^


    It doesn't matter who makes the drivers, they are different drivers running on completely different operating systems.

    I'm not disputing that the graphics performance on Macs is generally lower when compared to Windows given the same hardware, it's common knowledge that it is. I'm arguing that the biggest factor in that performance difference is the drivers that are included in OS X by the chipset manufacturer and Apple.
  19. 01mggt macrumors 6502

    Jun 23, 2010
    Humm, seems this post is going off the beaten path. To the OP I have bene using ML with 8gb ram and not had any issues with memory management at all. Even on my 2008 umb with a traditional hdd. Also I agree you need to do a clean install. Not to mention you should probably scale back on keeping some programs open when not in use. It seems as if you are saying you have open safari, contacts, app store steam and the other stuff while also trying to process large images in photoshop.
  20. VinegarTasters, Jul 19, 2012
    Last edited: Jul 19, 2012

    VinegarTasters macrumors 6502


    Nov 20, 2007
    all this fuss

    Russ888 is telling me don't criticize Apple.
    Sickboy is telling me don't criticize Android.

    Well, why not just criticize the technology decisions, who cares about what company or what person made the mistake.

    Java/C#/Python is slower than ObjectiveC
    ObjectiveC is slower than C++
    C++ is slower than C
    C is slower than assembly.

    Virtual Machines is slower than native code.

    JIT compiling is JIT compiling. In java, it is trying to get the virtual machine interpretation into native code. In OpenGL, it is trying to get runtime interpretation into native code.

    Clang via LLVM is slower than GCC (minimum 10% slower, and can go up to 100% or more slower depending on how badly the "bytecode" is recompiled into CPU instructions). Remember Clang via LLVM will compile into LLVM IR, THEN it is recompiled into CPU instructions. The "LLVM IR" is similar to Java bytecode. It was purposely build this way so they can easily port the code and support different languages. They did this because C# and managed code uses this similar technology so they are essentially copying each other. Goal was so they can compile different languages to LLVM IR and then recompile the LLVM IR into cpu instructions.

    Guess what? LLVM IR can support virtual machines and you can have a front end that compiles interpreted languages like Java. In essence trying to cram every front end compiler result into LLVM IR means you need to carry all the baggage of interpreted languages like automated reference count, code all of a sudden turning on by itself to clean up, EATING UP A TON OF MEMORY BEFOREHAND to support garbage collection. Even if the purpose of LLVM is to optimise and speed up, carrying all that baggage means it is actually SLOWER.

    Again, THEY CAN'T MATCH GCC using Clang via LLVM. The best they can do is 10% slower, so supporting this technology is not optimizing and speeding up, it is actually slowing the code.

    Is this the cause of Lion being so slow? We know the kernel of OSX now takes up a HUGE amount of memory in Lion and later versions. We know Lion is multiple times slower than Snow Leopard. We know Apple leaves LLVM IR code everywhere (at least in opengl), requiring JIT compiling. What other pieces are left in this "bytecode" requiring interpretation or JIT at runtime? It is no different from a virtual machine.

    Now I know a few people are gonna get hurt over this because of these revelations. But no matter how much zeal you have it is not gonna change the fact that it is gonna affect them in the short term and long term. Corel basically tanked trying to get an office version using interpreted languages. Everyone knows Windows runs games faster than OSX. .NET (interpreted) and Java games can never get to AAA level like Modern Warfare and Battlefield.

    So in conclusion: interpreted and slow stuff DON'T belong in operating systems (and vast majority of games). The OS is the normally the lowest layer along with drivers. It should be coded in assembly at best, C at worst. Because it is the lowest common denominator for performance, as all other apps run on top of it. Either this lesson can be learned now, or they can follow the path of Corel and find out why people buy games on windows and not on OSX.
  21. luigi.lauro, Jul 19, 2012
    Last edited: Jul 19, 2012

    luigi.lauro macrumors member

    Jun 18, 2012
    Milan, Italy

    As of 2012, LLVM-Clang is as fast as GCC, actually *FASTER* for certain code, slower for others.

    Overall they are equal, some is faster for certain tests, some is faster for others, while the average is within 1% difference.

    In the future, it's quite probably given the LLVM-Clang more modern and flexible approach that we will see LLVM-Clang improve at a faster pace than GCC, as it has been in the last 4-5 years, catching up with GCC while GCC was struggling improving as fast as LLVM has been.

    But even *TODAY* GCC is not faster than LLVM/Clang, they are the same.


    Please stop spreading non-sense about LLVM-Clang as a compiler.

    It's a compiler, has nothing to do with VMs, it compiles to native code, the only thing that is important is how fast it compiles code and how fast is the code that it compiles.

    And LLVM-Clang produces code it's already as fast as GCC, while being a lot faster and using less disk/memory to compile.

    Even major performance-oriented projects such as FreeBSD are switching from GCC to LLVM-Clang. It's simply the future :)
  22. dcorban macrumors 6502a


    Oct 29, 2007
    It's likely his only symptom is dry eyes from staring at Activity Monitor for too long.

    If he is truly experiencing massive paging, then it must be from something he has installed. I expect that anyone who goes through the trouble of installing a an app to "free memory" is also the type who will have installed other questionable software. This behaviour goes all the way back to Windows 98, when it was usually the software intended to "speed things up" that caused the most problems.
  23. Runt888 macrumors 6502a

    Nov 17, 2008
    I never said you couldn't criticize Apple. Just stop spouting nonsense.
  24. Death-T macrumors regular


    May 18, 2012
    Savannah, Georgia
    Not sure that this means anything, but I just opened a butt ton of applications, several games, and so on running Mountain Lion GM with 12 GB of RAM and I still have 6 GB free.

    Attached Files:

Share This Page