1 29 30 31 32 33 Previous Next 957 Replies Latest reply: Dec 1, 2013 1:28 PM by Jonathan Payne1 Go to original post
  • 450. Re: Lion - Memory Usage Problems
    Michelasso Level 1 Level 1 (65 points)

    R C-R wrote:

     

    Yet later you say that you "took the picture just after the kernel started paging out and was still paging," & start talking about delayed (4 page clustered) writes to the backing store, which contradicts the "one shot" idea.

    That is the problem, you always see contradiptions in anything that doesn't fit with your idea. The process is simple and I never mentioned any delay:

     

    - One or more processes in the system keep requesting more and more physical memory

    - The page out process selects clusters of pages, with 1 to 4 pages per cluster, to be swapped out

    - These clusters get put into the I/O buffer for disk writing

    - The clusters in the I/O buffer gets written into the swapfiles on disk. This is done in parallel with the page out process execution.

    - Rinse and repeat

     

    By the time a chunk of data gets written out to the swap files the page out process could put again in the queue hundreds of times the same amount of data. As soon as a chuck of data gets written on disk there are already many others waiting for their turn to be swapped out. That's why the disk activity, which I monitor with iStat menus, when thrashing is constantly nearly at the max. And that's why a trashing slows down the whole system, because processes may get put on wait until some memory has been freed and that doesn't happen until the previous chuck of memory has been effectively paged out.

     

    These are few of the first basic IT principles that one gets to study in the Computer Science classes at University. It doesn't matter if it is VAX VMS, Unix, IBM OS or whatever. Principles that one should study consistently from books in a propaedeutic order, and not from collages of pieces taken here and there. As for man pages the documents one may find are just good later as references. They can't be and are not a substitute for a serious studying of the subject. Otherwise, what one gets in his or her head is just Confusion.

  • 451. Re: Lion - Memory Usage Problems
    Michelasso Level 1 Level 1 (65 points)

    All right, I have eventually found the system command to show the virtual memory usage along other kernel values, sysctl:

     

    This is what the man page says:

     

         Information about the system's swap space usage may be obtained with:

               sysctl vm.swapusage

     

    Running it from terminal this is what I've got:

     

    $ sysctl vm.swapusage

    vm.swapusage: total = 1024.00M  used = 543.50M  free = 480.50M 

     

    Which matches exactly the iStat Menus and Activity Monitor "Swap Used" value. One can check himself as soon as some paging activity starts. These are the swap files present in the system at that time:

     

    $ ls -l

    total 8388608

    -rw------T  1 root  wheel  3221225472 22 Set 08:57 sleepimage

    -rw-------  1 root  wheel    67108864 21 Set 09:38 swapfile0

    -rw-------  1 root  wheel    67108864 22 Set 14:30 swapfile1

    -rw-------  1 root  wheel   134217728 22 Set 14:30 swapfile2

    -rw-------  1 root  wheel   268435456 22 Set 14:30 swapfile3

    -rw-------  1 root  wheel   536870912 22 Set 14:30 swapfile4

     

    Their total size is 1GB indeed. I hope that this clears up few things once and for all.

  • 452. Re: Lion - Memory Usage Problems
    uncas_ripley Level 1 Level 1 (0 points)

    Wow.  This thread is either:

     

    a) an example of what is best about online discussion forums, where anybody can participate and express their oppinions on any topic.

     

    OR,

     

    b) an example of how a simple problem report (i.e. Safari using huge amounts of memory in Lion), can morph into never ending discussion on virtual memory, swap, and inner workings of Darwin kernel, Safari, Lion etc. etc.

     

     

    I just have one question for everyone.  Does anybody actually believe that there is NO problem with Safari in Lion?

  • 453. Re: Lion - Memory Usage Problems
    radioroe Level 1 Level 1 (0 points)

    The process displayed on the Activity Monitor "Safari Web Content" is hogging 99% of CPU intermittently.  Have OSX 10.6.8, 4GB Ram, 2.4 Core 3 Duo, MacBook Pro. Oddly, compared with others here, it is not hogging memory, only 256 MB at most.

     

    I have owned the MacBook for about 6 months.  This problem first occurred about a month ago, and it is getting worse.

     

    Today I updated Adobe Flash. Then I deleted the one Safari extension I had installed.

     

    Ran fine for a half hour, while I was doing Yahoo Mail and checking the Apple support website, Then everything came to a halt with 99% CPU consumption.  Closed Safari, reopened and it was OK.

     

    So, these are NOT the problem, tried them all today:

    -Lion (don't have it yet)

    -Extensions (deleted all)

    -Adobe Flash  (updated it today)

    -Needing to empty Safari Cahche (did that, too)

     

    I am going to try switching to Firefox which I used prior on a PC and liked. I can't deal with this day in and out.

    RR

     

    -

  • 454. Re: Lion - Memory Usage Problems
    Naggis Level 1 Level 1 (0 points)

    I don't think anyone can say there is no problem for anyone, as always some people are experiencing issues. I certainly don't believe its Safari thats got the problem after my experience tonight. /___sbsstatic___/migration-images/162/16210625-1.jpg

     

    Check out the stats in the image attached. Now i'm used to rebooting safari for the moment, geektool helping me out so i can always check my ram usage but itunes was using 1.5gb of ram all of a sudden and nigh on 100% processor.

     

    I have a few addons to my system that improve my productivity that until now i have not been willing to part with even for science but i may have to see if something is causing the problem.

     

    This was the first time anything but safari has caused issues since getting Lion and i always have iTunes open and as always was simply playing a song, nothing else. No videos or adding of anything, no hard drives mounted just an iphone charging.

     

    Whatever is wrong with Lion at the moment thats causing these insane spikes, there are clearly a few issues.

    Lets just pray to Steve/Tim that 10.7.2 is the saviour.

    ---------------

    iMac, fully updated lion, 2.4 Core 2 Duo, 4gb, 320 + 1tb not mounted, 20" + 17" added. (More RAM isn't really an option at this point, nor is it necessary.)

     

    /___sbsstatic___/migration-images/162/16210625-1.jpg

  • 455. Re: Lion - Memory Usage Problems
    R C-R Level 6 Level 6 (14,160 points)

    Michelasso wrote:

    Swap Used is, according to the Activity Monitor help page itself, the amount of disk space currenty used as virtual memory. Which it can't be anything else than the total of RAM pages currently swapped out to disk.

    But it is something else. To see why, consider a room in a hotel used for business meetings. The room has 200 seats in it. A meeting begins. I assume you would agree that the amount of seating space currently used for the meeting is 200 seats, right?

     

    20 people attend the meeting. This is not somehow another measure of the current seating space, just of how many of its seats currently are occupied.

     

    It is the same with "Swap used." Like with seating space, it is the amount of disk space currently used but it isn't necessarily the number of pages currently filled.

  • 456. Re: Lion - Memory Usage Problems
    Michelasso Level 1 Level 1 (65 points)

    R C-R wrote:

     

    But it is something else. To see why, consider a room in a hotel used for business meetings. The room has 200 seats in it. A meeting begins. I assume you would agree that the amount of seating space currently used for the meeting is 200 seats, right?

     

    20 people attend the meeting. This is not somehow another measure of the current seating space, just of how many of its seats currently are occupied.

     

    It is the same with "Swap used." Like with seating space, it is the amount of disk space currently used but it isn't necessarily the number of pages currently filled.

     

    ? Swap used is 20 seats and the available swap space is 180 seats. That is shown by the output of sysctl

     

    $ sysctl vm.swapusage

    vm.swapusage: total = 1024.00M  used = 543.50M  free = 480.50M

     

    1024 seats available, 543.5 used, 480.5 free. My idea is that  the "page ins" and "page outs" numbers in Activity Monitor are giving out misleading informations. Why?

     

    Let's take "Page outs" for example. It is the same exact number of "Pageouts" in vm_stat output multiplied by the page size (4KB). The same for "Page ins". That IMVHO is wrong because the "Pageouts" and "Pageins" in the code are counters that keep getting incremented by 1 by the pagers. vm_stat just prints those numbers. This is the code section for printing the current values (not reiterating):

     

    snapshot(void)

    {

     

    get_stats(&vm_stat);

    printf("Mach Virtual Memory Statistics: (page size of %d bytes)\n",

    (int) (pageSize));

     

    sspstat("Pages free:", (uint64_t) (vm_stat.free_count - vm_stat.speculative_count));

    sspstat("Pages active:", (uint64_t) (vm_stat.active_count));

    sspstat("Pages inactive:", (uint64_t) (vm_stat.inactive_count));

    sspstat("Pages speculative:", (uint64_t) (vm_stat.speculative_count));

    sspstat("Pages wired down:", (uint64_t) (vm_stat.wire_count));

    sspstat("\"Translation faults\":", (uint64_t) (vm_stat.faults));

    sspstat("Pages copy-on-write:", (uint64_t) (vm_stat.cow_faults));

    sspstat("Pages zero filled:", (uint64_t) (vm_stat.zero_fill_count));

    sspstat("Pages reactivated:", (uint64_t) (vm_stat.reactivations));

    sspstat("Pageins:", (uint64_t) (vm_stat.pageins));

    sspstat("Pageouts:", (uint64_t) (vm_stat.pageouts));

    #if defined(__ppc__) /* vm_statistics are still 32-bit on ppc */

    printf("Object cache: %u hits of %u lookups (%u%% hit rate)\n",

    #else

    printf("Object cache: %llu hits of %llu lookups (%u%% hit rate)\n",

    #endif

    vm_stat.hits, vm_stat.lookups, percent);

     

    }

     

    vm_stat.pageouts gets incremented only once in the module vm_pageouts.c (the default pager) by the VM_STAT_INCR() macro:

     

    if (page_list[entry].dirty) {

                                                                VM_STAT_INCR(pageouts);

                                                                DTRACE_VM2(pgout, int, 1, (uint64_t *), NULL);

                                                                pgpgout_count++;

                                                      }

     

    Please note as an additional pgpgout_count (pages paged out) counter is present.

     

    Now, I am not able to catch where the so called "swap used" value gets updated (the source code is much bigger than what I thought). What I know is that the Universal Page List can mark as clean some dirty pages adjacent to the original one requested to be paged out, and flush them all together as a cluster of pages to the backing store (so paged out, swapped out, whatever. They are used by many as interchangeable terms in this contest) still keeping the copy of some of these pages in RAM. These pages increment the used backing store size but not the pageouts counter. Which is 1 for for each cluster of pages flushed to disk.

     

    This would be a sort of cache (again). But since those pages are inactive and clean they would be the first to go (without the need to page them out again. They are marked clean) if free memory is needed before they get reused (and so put in the inactive list) if ever. Let's say, as usual, it would optimize I/O performances.

     

    This would explain why the number of pages swapped out in the backing store  (= swap used / page size) is superior to the pageouts counter at the beginning of the first paging out activity. But yet again it wouldn't give the answer to the original questions of this discussion.

  • 457. Re: Lion - Memory Usage Problems
    Michelasso Level 1 Level 1 (65 points)

    uncas_ripley wrote:

     

    I just have one question for everyone.  Does anybody actually believe that there is NO problem with Safari in Lion?

    Some people do. They have 8+ GB of RAM in their machines and they are not bothered that the web browsers are requiring more and more RAM in a exponential fashion. The answer is: who cares, RAM is cheap. They are not necessarily in this discussion. I have read this many times elsewhere.

  • 458. Re: Lion - Memory Usage Problems
    mightymilk Level 1 Level 1 (20 points)

    Michelasso wrote:

     

    uncas_ripley wrote:

     

    I just have one question for everyone.  Does anybody actually believe that there is NO problem with Safari in Lion?

    Some people do. They have 8+ GB of RAM in their machines and they are not bothered that the web browsers are requiring more and more RAM in a exponential fashion. The answer is: who cares, RAM is cheap. They are not necessarily in this discussion. I have read this many times elsewhere.

     

    Near the beginning of this thread, someone posted a screenshot from a Mac Pro with 32GB of RAM, all of it was used up and numerous applications were unresponsive.  This is definitely not an issued related to the physical amount of RAM in someones machine.  My MacBook Pro does the same thing whether you feed it 2/4/8GB or RAM.

  • 459. Re: Lion - Memory Usage Problems
    Michelasso Level 1 Level 1 (65 points)

    mightymilk wrote:

     

    Near the beginning of this thread, someone posted a screenshot from a Mac Pro with 32GB of RAM, all of it was used up and numerous applications were unresponsive.  This is definitely not an issued related to the physical amount of RAM in someones machine.  My MacBook Pro does the same thing whether you feed it 2/4/8GB or RAM.

    Then what is it? Are we the unlucky b@stards? I did everything I could to cleanup my machine. Now with the new Seagate Momentus XT HDD (the WD Blue Scorpio died. 2nd in 2 years...) I even boot in less than 20 seconds! Another 20s to resume the login.

     

    Then after 1 or 2 hours something kicks in (usually Safari but not only), and... I get the disaster we know. I mean, I am rebooting twice a day. Leaving it on everything slows down dramatically. Thanks God for Resume and the new HDD otherwise it would be a nightmare.

  • 460. Re: Lion - Memory Usage Problems
    mightymilk Level 1 Level 1 (20 points)

    Michelasso wrote:

     

    mightymilk wrote:

     

    Near the beginning of this thread, someone posted a screenshot from a Mac Pro with 32GB of RAM, all of it was used up and numerous applications were unresponsive.  This is definitely not an issued related to the physical amount of RAM in someones machine.  My MacBook Pro does the same thing whether you feed it 2/4/8GB or RAM.

    Then what is it? Are we the unlucky b@stards? I did everything I could to cleanup my machine. Now with the new Seagate Momentus XT HDD (the WD Blue Scorpio died. 2nd in 2 years...) I even boot in less than 20 seconds! Another 20s to resume the login.

     

    Then after 1 or 2 hours something kicks in (usually Safari but not only), and... I get the disaster we know. I mean, I am rebooting twice a day. Leaving it on everything slows down dramatically. Thanks God for Resume and the new HDD otherwise it would be a nightmare.

    I really don't know.  I've been all over Google trying to figure it out, I'm having major performance and memory issues too.  It's all over the MacRumor forums, I've seen a ton of suggestions but nothing that actually solves the problem.  I'm getting ready to bite the bullet and do a clean install, as a last resort.

     

    I've heard a lot of people suggesting some of the new features in Safari could be causing the overly high memory usage.  It still doesn't explain why OS X won't return Inactive RAM to the system for use.  I'm doing the same thing you're doing, Quitting/Purging/Restarting daily. 

     

    I don't even have to look at Activity Monitor to know it's paging.  I'll sit there doing simple daily tasks and as soon as I notice ballons and overall sluggish performance, I launch Activity Monitor and sure enough there's about 2GB of Active RAM, 500MB of Wired RAM, and the rest is Inactive with 0 Free RAM available and the Page Out #'s just keep climbing.

  • 461. Re: Lion - Memory Usage Problems
    superdifficult Level 1 Level 1 (0 points)

    I'm just going to add my voice to the chorus. Also having crazy performance issues on a 13" MacBook Pro bought less than 1 year ago. Core 2 Duo, 4GB RAM. Snow Leopard flew. Lion crawls...

  • 462. Re: Lion - Memory Usage Problems
    Adam Ullrich Level 1 Level 1 (5 points)

    I've had this issue as well. 8GB of RAM and Lion starts out fine but eventually eats it all up and won't give it back. One thread I found suggested the "purge" command in terminal which seems to work great. On my machine it'll often free 3+GB of RAM back to the pool and the system becomes responsive again. Have you guys tried this?

  • 463. Re: Lion - Memory Usage Problems
    Krissypaps Level 1 Level 1 (0 points)

    I started reading this thread because my nephew is having this problem with his brand new MacBook Air.  At first, it was very fast.  Now Safari slows to a crawl and can't load pages.  I had hoped that reading this thread would give me some ideas as to how to help him but I see that there is no consensus as to what it causing it or how to fix it for those who have it.

     

    I just want folks who are reading this to know that not everybody using Lion and Safari is having this problem.  I have a 2006 MacBook Pro, Core 2 Duo with 3 GB of RAM.  I am running Safari in 64-bit mode.  I have not experienced any slow-down.  In fact, everything seems to run much quicker in Lion on my computer.  I have noticed that the Safari Web Content process seems to be using the most RAM at any one moment.   I just checked Activity Monitor with this thread open and Safari Web Content was using 240.5 MB of RAM.  The next process down is always kernel_task.  I have no page outs listed.  I have the lastest version of Flash Player installed.  I have a few extensions installed and enabled.  Ad Blocker is installed but not presently enabled.

     

    I will check back periodically to see if anybody has come up with a solution for those who are having this issue.

  • 464. Re: Lion - Memory Usage Problems
    UmpaEG Level 1 Level 1 (25 points)

    What build of OSX Lion are you running ?

1 29 30 31 32 33 Previous Next