Does my memory leaking?

Discussion in 'MacBook Pro' started by Folmanik, Jan 29, 2013.

  1. Folmanik, Jan 29, 2013
    Last edited: Jan 29, 2013

    Folmanik macrumors newbie

    Joined:
    Aug 26, 2007
    #1
    i searched for a bit and i understand that the mac is different from pc in the way he uses memory, but i still don't understand why my mac uses that much memory..

    i have a week old macbook pro 13 inch with 8 gb ram, one of the first apps i installed was memory clean, which suprised me by telling me i have only 3 gb of free space (it was before getting familiar with activity monitor),
    so, i read about the types of memory (active, wired, etc.) but i still can't manage to understand how is it possible that a week old computer uses between 4 and 7.5 gb of memory without running too many apps..

    should i worry or the is it normal?

    thanks in advance!
     
  2. Crzyrio macrumors 65816

    Joined:
    Jul 6, 2010
    #2
    Nothing to worry about!

    It just stores all those apps you have already opened and closed in memory as well, that way when you go to open that app again its much faster :)

    If you open different apps it will start to automatically remove stuff from the memory to make room for the new app
     
  3. Folmanik thread starter macrumors newbie

    Joined:
    Aug 26, 2007
    #3
    thanks!

    thanks a lot!!

    i searched around but couldn't find a definitive answer for that..

    just couldn't realize how a person with 4gb or less handles the mac..
     
  4. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #4
    I have several Macs with 4GB of memory and they all run just fine.
     
  5. F1 Fan macrumors regular

    F1 Fan

    Joined:
    Apr 18, 2012
    Location:
    UK
    #5
    Admittedly I know almost nothing about this but from what I have seen others saying elsewhere OS X will try to use as much RAM as you give it to improve your experience. Once the basic needs are met any extra RAM you have is used to smooth things out in less and less major ways.
     
  6. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #6
    Your Mac will use whatever memory is available. That's what it's there for. The only thing you need to watch for is page outs, which indicate that you're maxing out your RAM.

    To determine if you can benefit from more RAM, launch Activity Monitor and click the System Memory tab at the bottom to check your page outs. Page outs are cumulative since your last restart, so the best way to check is to restart your computer and track page outs under your normal workload (the apps, browser pages and documents you normally would have open). If your page outs are significant (say 1GB or more) under normal use, you may benefit from more RAM. If your page outs are zero or very low during normal use, you probably won't see any performance improvement from adding RAM.

    Using Activity Monitor to read System Memory and determine how much RAM is being used
     
  7. leman macrumors 604

    Joined:
    Oct 14, 2008
    #7
    The question you should be asking yourself is whether you have any performance problems. RAM usage statistics by themselves mean nothing. They only become meaningful if you run into performance problems.

    As mentioned above, a good way to see whether your system is struggling with RAM is to inspect the number of page-outs compared to page-ins. If the ratio of page-outs is constantly over 10%, then you really might have something hogging RAM.
     
  8. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #8
    There is no meaningful correlation between page outs and page ins. You will always have page ins, but you may not ever have page outs. Also, you can run for weeks or months, accumulating page ins, then go through a period of intense activity for only a few minutes which produces page outs. No ratio between the two is useful. The only thing that indicates a need for more RAM is the presence of significant page outs during normal workload, regardless of the page ins.
     
  9. swerve147 macrumors 6502a

    swerve147

    Joined:
    Jan 12, 2013
    #9
    When monitoring your page outs make sure you're monitoring your normal usage over a longer period of time to get a good sampling of your RAM usage. A single, simple rogue process like Flash mis-utlization on a webpage can easily cause your RAM to be over-utilized and page-outs to shoot through the roof.
     
  10. sniffs macrumors regular

    sniffs

    Joined:
    Jan 24, 2013
    #10
    What's odd is that I got a brand new MBP with 4GB of ram.. I noticed that I rarely went above 3GB usage, even running Outlook all day and Firefox and some little apps in my finder bar..

    I upgraded to 16GB of ram and now noticed that instantly my mac is using 7-9GB of ram.. It's very strange and I don't know why..

    Another thing I noticed is that the amount of ram installed correlates to the size of your "sleepimage" .. mine went from 4GB to 16GB so now it's eating up another 12GB of disk space..
     
  11. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #11
    That's normal, as the contents of RAM are copied to the sleepimage before your Mac sleeps.
     
  12. 1member1 macrumors 6502

    Joined:
    Sep 8, 2012
    #12
    It's ok unless you feel some downgrade in your performance.
    I got 8gb as well sometimes 4 or 5GB taken and i'm just growing the web, listening to music and chat with people.

    OSX use your memory way different and there are more things in the management of the operating system that will feel different from windows.
     
  13. leman macrumors 604

    Joined:
    Oct 14, 2008
    #13
    This is basically what I said, didn't I? Of course the proper window of observation is the most important thing here.

    And of course the ratio of page outs to page ins is meaningful: this directly represents the proportion of page misses - which is exactly the thing that leads to reduced performance.
     
  14. robvas macrumors 68020

    Joined:
    Mar 29, 2009
    Location:
    USA
    #14
    It's just not purging items from RAM like it does when you have less memory. The idea is that if you need to access those objects again, they are still in RAM. But if you need the space for something new, the system allows them to be overwritten.
     
  15. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #15
    No, it's not meaningful. You could have 1GB of page outs with 5GB of page ins or 50GB of page ins. Both page ins and page outs are cumulative since the last restart, so some may restart daily, while others may restart after several months. The fact remains that at some point, you're maxing out the RAM. The user needs to determine if that occurred during normal workload or not, regardless of how long since the last restart.
     
  16. leman macrumors 604

    Joined:
    Oct 14, 2008
    #16
    This is why I said that you have to control the observation window. This can be done by zeroing the counters (restarting) and then inspecting the ratio again after having performed a representative workflow session. Sorry if I didn't make myself more clear.

    Another possibility is just not to restart at all for a very long time. Because the counters are cumulative, the statistical signal will 'smooth itself out' given enough time (as we can assume that untypical memory load situations only occur rarely).
     
  17. sniffs macrumors regular

    sniffs

    Joined:
    Jan 24, 2013
    #17
    Ah ok.. that makes complete sense. Thanks.
     
  18. Folmanik thread starter macrumors newbie

    Joined:
    Aug 26, 2007
    #18
    thanks a lot!

    but when you say to watch over the page in/page out to see if it get's over 1GB or 10%, after how long should i watch the activity monitor?

    cause i guess that after 1 day you'll have less then after 1 month..


    for now, after 1 week without restart i have 2.5GB of page out..
     
  19. Folmanik thread starter macrumors newbie

    Joined:
    Aug 26, 2007
    #19
    correction,
    after 3 days i have 3gb of page out (and 55 of page in if it matters)

    is it ok?
    you're saying "more than 1 gb" but in what period?

    thanks
     
  20. dusk007 macrumors 68040

    dusk007

    Joined:
    Dec 5, 2009
    #20
    You aren't make any more sense. This is why he said ratio. If you have 50GB page ins your system was probably up a long time and the 1GB page outs most definitely wasn't "normal" usage.
    If the window is very small and you are only at 5GB than it is at least indicative that there might be an issue with 20% page outs. It could be an exception or it could keep growing like that.
    The page ins are the most primitive way of showing how long the system has been up. How many page outs that don't really matter may have occured.
    20% vs 2% is quite a difference. Wouldn't you say?

    5% page outs vs page ins is definitely not a problem. I got way more at 10% (108 vs 10GB) and the only time they actually happen is when I throw the VM on at which time there is plenty that can be swapped out without any loss in responsiveness.
    Generally swapping isn't much of a problem if the only cause is too many residing apps and not one big one or if you constantly use everything that is open. If you have an SSD it is even less of a problem because swapping is so fast.

    Forget more than 1GB. Just go with the ratio. Under 10% you are definitely fine. About 20% you may want to look at more ram if it isn't too expensive. Much over 20% and you really need more RAM.
    I would watch for at least a full day of work. The longer the better.
     
  21. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #21
    A high amount of page ins could indicate a long uptime, but it can also be driven by the apps, documents, etc. in use. You could have 50GB of page ins after a month, or after a few hours. The time frame isn't reflected in the amount of page outs. You may have operated for weeks with 10GB of page ins, then launched a memory intensive app that burned through 40GB of page ins in a few hours.

    Exactly. A much more accurate method is to simply look at uptime.

    That depends on the amount of page outs. If the page outs are 70MB, the user won't notice it. If the page outs are 15GB, the user will likely notice an impact on performance. That's because the amount of page outs, and the amount of time the system is waiting on HDD read/write events, directly impact performance, whether that amount represents 5% or 50% of page ins.

    Again, the ratio is meaningless. Performance isn't impacted because a ratio was reached. Performance is impacted when significant page outs occur, regardless of the amount of page ins or the ratio. The same amount of time is spent waiting for 5GB worth of page outs, whether those page outs are 2% or 20% of page ins. The impact on performance is the same.
     
  22. dusk007 macrumors 68040

    dusk007

    Joined:
    Dec 5, 2009
    #22
    The uptime doesn't really tell you anything more.
    If it happens so rarely that it doesn't show in the in/out ratio than it most likely just doesn't matter. The ratio tells you how much it actually means, how much more RAM would probably get you.
    Uptime won't help you there in an significant way.

    A page out in a modern OS doesn't impact performance in the least. Only if you have a really slow HDD but most of the time there is enough inactive stuff mirrored in the swap long before you actually run out of space. The system usually doesn't stall while it waits until stuff is successfully swapped out. That would be a memory management designed by an idiot or one with swap turned off. The performance hit occurs when the stuff is read back in or when it is so much so fast that it is overwhelmed (rarely happens with consumer workload i.e. many apps/files... rather than one memory monster professional app). The ratio gives an idea how often that swap is used and thus an idea how much use one can get out of more RAM.
    Most of the time swapping works really fast and is only noticeable by short stalls or slow downs. If that doesn't happen often what difference does it make.

    The total of page outs is quite meaningless without lots more data about how long one used the system, what did he do, one app or many. Page ins is simply the work the memory system had since restart. If page outs are a high percentage of that many of those page ins come from swap and that hurts.
    If swap is only as big as the page outs, it is only stuff that isn't used; written once and forgotten.
    If the OS can keep all the important stuff in main memory page ins will always grow much faster than page outs. Only if it cannot it has to page out often and page in again. This are the cases when the ratio will go higher and this indicates a problem more clearly and accurately than anything else you can read from activity monitor. It is imo the simplest and most accurate advice one can give. Everything more accurate it complicated and requires some actual monitoring, or creates non objectively valid data. Some people here think they need more RAM after they see a bit of swap.
     
  23. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #23
    There is nothing in a page in/page out ratio that will indicate how much more RAM will improve performance. Nothing.
    A single page out, no. For significant page outs, that is clearly false, as is well-documented all over the web.
    Even a fast SSD is not as fast as RAM, so significant paging activity will impact performance in every case, just not as noticeably with a SSD vs a HDD.
    Writing and reading to a swapfile are both much slower than RAM speed, so the performance is impacted either way. Any time data is being written to or read from a HDD or SSD, the system is not performing as fast as it would if paging activity had not occurred.
    Page outs indicate that at some point since the last restart there was not sufficient RAM to handle memory demands. I agree that more information is needed about the source of the page outs, which is why I recommended restarting and tracking page outs under the normal workload. If the page outs occur only with a single rarely-used app, or other unusual scenario that isn't likely to be repeated often, more RAM may not be required. If page outs occur regularly during normal activity, more RAM may be helpful. Tracking page ins or a ratio does not provide any useful information in making a determination whether more RAM is needed.
     
  24. dusk007 macrumors 68040

    dusk007

    Joined:
    Dec 5, 2009
    #24
    That is supposed to mean approximately. It gives you an idea about whether there is an issue or not. Nothing? Seriously?
    It may also only indicate that some thresholds have been reached where memory management though that some memory should be preemptively swapped so that there is enough space to page in stuff when needed. If you run for a long time and only with very low page outs that is probably the only kind that ever occurred.

    Most of the things you claim really only happen if you have loads of page outs with a very high ratio because otherwise if you run long enough page ins will always be huge in comparison. Once you have a ratio that is higher than 10% this other stuff like serious page outs and the performance of the SSD to actually become a problem may happen.
    It gives you a useful information whether more RAM is NOT needed. Which is all most people on such forums really need to know, because they usually worry way too much. Once the answer is a maybe one can do all the in detail monitoring.
    If you have a normal workload that requires more RAM, your ratio will be higher. The correlation will definitely be there.
     
  25. Folmanik thread starter macrumors newbie

    Joined:
    Aug 26, 2007
    #25
    thank you all for you're help!!

    btw,
    turns out the thing that made me page out so bad was quite ironically an app called "memory clean" which moved my unactive memory into free memory,
    my roommate bought the exact same computer and i went to check what's his "page out" stats and he had none and the "memory clean" was the only app that he never installed that i did,
    so i made a restart and never used the app and walla, 0 page outs after 2 days, to make sure i used it once 2 minutes ago and now i have 200 mega of page out..

    again..you are great!!!
     

Share This Page