Question about memory usage

Discussion in 'Apple' started by JF Mezei, Sep 29, 2013.

  1. JF Mezei

    JF Mezei Guest

    Currently running Premiere to stabilize a video. Been running since last
    night. It consumers 9gigs of "real memory" on a 12 gig machine.

    Activity monitor reveals:

    Free: 9 megabytes (aka: 0)
    Wired: 1.12 gig
    Active: 7.26 gigs
    Inactive: 3.62 gigs

    1- If a process is shown as using 9 gigs of ram, how come the "Active"
    is less ?

    2- How come the inactive isn't being trimmed back down since there is
    essentially 0 free RAM left and system paging quite a bit ?

    3- If a process makes use of say 1 gig of shared memory (code that is
    shared between processes for instance). Would that memory be billed to
    "Inactive" ? or would it be billed to each process that has a mapping to
    this memory ? In the later case, adding all of the "real memory" units
    in Activity Monitor would result in more RAM being used than there is
    physically installed.

    Does "Inactive" contain common blocks of memory such as shared code and
    shared structures ? (this might explain why it isn't being trimmed down
    since that code would be necessary). I was under the impression that it
    was primarily a glorified cache of recently memory still considered
    valid which could be remaopped toa process shoudl it need it. (for
    instance, code from "" that can be remapped to a process
    starting a new instance of The way I read it, this was easily
    disposable memory should there be a need for it.

    (This is on Snow Leopard BTW)

    (Additional note: Premiere seems to build something , increasing memory
    big time and a couple hours later, back down to 2-3gigs of RAM and then
    starts the buildup again). Its virtual memory seems stable at about 12 gigs.
    JF Mezei, Sep 29, 2013
    1. Advertisements

  2. JF Mezei

    Bob Harris Guest

    In active memory contains data or code that the OS thinks may be
    reused. The inactive memory may have dirty data which needs to be
    flushed to disk before the page can be reused for something else.

    Moving data from inactive to free may require I/O, and if that
    data was needed again, another I/O to get it back. So the OS tends
    to defer removing items from inactive until it cannot obtain
    memory from free. But when it starts taking memory from inactive
    for a new purpose it will most likely start to force paging.

    If you are paging, then it does not matter if you are stealing
    from inactive or removing memory from an application(s), as I/O is

    It is hoped that the OS using some kind of aging algorithm to
    choose older pages whether from inactive or another program, and
    some fairness to not penalize an app that is not a memory hog.

    If paging is affecting your performance, then either find a way to
    have less concurrent apps actively running, or add more RAM, or
    find an app that is less memory hungry.

    sar -g 60 100

    will let you monitor your pageout activity every 60 seconds for
    100 seconds (adjust numbers to suite your tastes). The timestamp
    will help you identify when you were experiencing high pageout
    activity, and maybe associate it with what you were doing at the
    time. Also the magnitude and frequency of pageout activity will
    tell you if you it paging is serious or just occurs in passing
    when you are transistioning apps, or doing something rare that
    does not really bother you that it runs slow.
    Bob Harris, Oct 1, 2013
    1. Advertisements

  3. I don't know if MacOS memory management follows the typical rule "free
    memory is wasted memory". I did notice a huge improvement in MacOS
    between 10.6 and 10.8. When swapfile grew beyond 4GB, my system would
    get sluggish. Depending on what my usage pattern was, this usually
    happened once a week, sometimes less. A reboot would remove the old
    swapfiles and I'd be back to normal. In 10.8, I sometimes see the
    swapfiles grow to 5GB, but then shrink. The files weren't deleted.
    They just weren't used. This is the sort of VM usage I expect.

    Unless you're an OS kernel/interals person, I'd focus on other things.
    Virtual memory isn't the same as mapping out memory usage on older
    Michael Vilain, Oct 1, 2013
  4. JF Mezei

    JF Mezei Guest

    So the values given by Activity Monitor are useless ? And "real memory"
    shown for a process does not represent the actual size of the working
    set that is in RAM at the moment ?
    JF Mezei, Oct 1, 2013
  5. JF Mezei

    Lewis Guest

    Real versus virtual. It may be using 9GB or VMEM, but only,s ay, 1GB of
    Real memory. Also, shared memory. To cause less confusion, I've disabled
    the virtual memory column in activity manager, as it's completely

    The only number you should care about at all, is the real memory column,
    and page-outs.
    Yep, it does.
    Yes, VM keeps getting better. Thought the only time I had real problems
    with large swap was on laptops where the amount of swap started to make
    a significant dent in the free space of the boot volume.

    Virtual Memory is good.

    Yes, I do happen to believe that love is mainly about pushing chocolate
    covered candies and, y'know, in some cultures, a chicken. You can call
    me a sucker, I don't care, because I do believe in it. Bottom line: it's
    couples who are truly right for each other that wade through the same
    crap as everybody else, but the big difference is they don't let it take
    them down. One of those two people will stand up and fight for that
    relationship every time. If it's right, and they're real lucky, one of
    them will say something.
    Lewis, Oct 1, 2013
  6. JF Mezei

    Bob Harris Guest

    "Working Set" is a VMS term. "Working Set" does not exist in the
    Unix world.

    Real Memory may or may not include shared memory segments. If it
    includes shared memory, then other processes using the shared
    memory also have it counted, and thus the real memory usage is
    over inflated. If not included, I'm not sure who gets to count
    shared memory :)

    Some aspects of Activity Monitor are find, others are cute, but
    next to useless. For example, the paging stats are not nearly as
    useful as the 'sar -g' command, in my opinion, as the Activity
    Monitor paging stats are from last boot, which really do not tell
    you anything, and pagein does not tell you if it from from a
    swapfile or paging in the executable code from the program file.

    As with VMS, Unix (and in our case Mac OS X flavor of Unix)
    virtual memory management is non-trivial and full of exceptions.
    It also changes from major Mac OS X release to release. With more
    focus on laptops, handheld devices, and saving power, it tries to
    avoid doing disk I/O, especially the kind that wakes up the disk
    once a minute to flush dirty pages, or write to a log.

    Again, if you are having memory problems, use sar -g to plot when
    you are having those problems, then decide if you can quit some
    apps during that heavy usage, or if you should add RAM, or start
    looking for a more memory efficient app.

    (former Digital customer using VMS on a VAX-780, then a Digital
    employee working on PATHWORKS for OpenVMS, and later Digital
    Unix/Tru64 UNIX; I even got my name in one of the VMS Internals &
    Data Structures credits for reviewing the "Index"; HP decided we
    should part ways about 8 years ago; in hindsight, I'm glad)
    Bob Harris, Oct 2, 2013
  7. JF Mezei

    Siri Cruise Guest

    Actually it is computer science term: it is the set of memory locations
    currently used by a process. On systems with paging, the operating system
    attempts to keep the working set of each active process paged in.
    Siri Cruise, Oct 2, 2013
  8. JF Mezei

    JF Mezei Guest

    So, any way to find out for sure what Activity Monitor says ?

    Anyone to know if "Inactive" memory includes shared memory ? This would
    explain why one process "Premiere" had 9 gigs of "real memory" shown,
    while "Active" showed a total of only 7gigs for all processes.

    This is more of a question of trying to figure out what Premiere was
    doing with 9gigs of RAM. (and ran for about 24 hours with memory
    repeat ( 3gigs grows slowly to 9 gigs, stays there for about 30 minutes,
    drops back to 3 gigs quickly).

    Since what I had read indicated that "inactive" memory was memery that
    was convenient to keep in RAM but could be disposed if needed, this is
    why I inquired why a system with non free memory left would still keep
    over 3gigs of "inactive".
    JF Mezei, Oct 2, 2013
  9. I looked briefly at THE MAGIC GARDEN and found some of it useful. After
    digging into VMS for 8 years as a DEC software specialist, I found the
    generalization kind of annoying. It was a functional spec for UNIX
    rather than an actual Internals and Datastructures reference manual.

    While most UNIX flavors don't have anything like the level of
    granularity for pre-process metrics (I/O, memory usage, CPU), I did see
    the concept of process active memory space which I mapped into WORKING
    SET. You can't really do much to limit or control it and I have no idea
    how threads and multiprocessing play into this on multicore systems.

    Much of the complaints that get posted here seem to assume that memory
    allocation is like in the old RSX days where you had to plan what tasks
    were running and consuming your memory space. Or maybe IBM mainframe

    Your suggestion to turn on sar to gather usage stats is useful. But
    without sources and VMS-like process controls, what can you do to manage
    a process that has a memory leak? I stopped using Safari for just that
    reason. My system's been much more stable with Chrome running all the
    time rather than Safari.
    Michael Vilain, Oct 2, 2013
  10. Inactive memory can include shared resources.
    It should be noted that 10.0 through 10.6 handle memory very differently
    than 10.7 through 10.8, and 10.9 will again be different. 10.6 has the
    traditional global memory pool while 10.7 has divides it up by process,
    which appears to be good intentions gone bad. I don't know exactly what
    10.9 does but it claims to compress inactive memory to reduce disk
    Kevin McMurtrie, Oct 2, 2013
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.