the activity monitor

Posted:
in Genius Bar edited January 2014
Question: under OSX (10.4) version, what is the reason why apps have such a huuuge virtual memory allocation? I mean do they use it? Why is it needed exactly? Couldn't Apple design simple apps that use very little memory? I can understand graphic processing apps needing VM but non grfx proc apps?

Comments

  • Reply 1 of 1
    lundylundy Posts: 4,466member
    Quote:

    Originally posted by hypoluxa

    Question: under OSX (10.4) version, what is the reason why apps have such a huuuge virtual memory allocation?





    It doesn't really mean anything - that's assigned according to the total VM swapfile available, and the current RAM allocation.

    Quote:

    I mean do they use it?



    Check your pageouts in Activity Monitor to see if you are hitting the VM.

    Quote:

    Why is it needed exactly?



    A lot of the VM is memory-mapped portions of apps and libraries that the system has determined are frequently used, and not necessarily pages that have been swapped out. That's why there are always many more pageins than pageouts.

    Quote:

    Couldn't Apple design simple apps that use very little memory?



    Sure, but nobody wants that. They want drag and drop, multithreading to keep the interface responsive, exporting in a bazillion different file formats, web code, network code, you name it. Also, there is always a trade off between space and time - space is cheap nowadays, and developer time to optimize for space isn't worth it. Nonetheless, Apple advises us to compile for space, as their tests show that with gcc that reduces pageouts and overall is the best compromise between a large fast application that risks getting paged out and a smaller slower program that has less of a chance of getting paged out.

    Quote:

    I can understand graphic processing apps needing VM but non grfx proc apps?



    Nothing says that an app "needs" VM. A Mach kernel based system will always assign VM because it allows memory mapping and the use of a larger address space than the physical RAM. Just because the system allocates an amount of VM does not mean that anything is actually going to get paged out.



    Check pageouts under System Memory in Activity Monitor or type vm_stat in the Terminal to see the pageouts. Anything that is just a few thousand is pretty good.
Sign In or Register to comment.