The Great Memory Leak test

Discussion in 'Mac Apps and Mac App Store' started by trip1ex, Mar 2, 2009.

  1. trip1ex macrumors 68000

    Joined:
    Jan 10, 2008
    #1
    I've kept my Mac on for days in order to test out these memory leaks that Safari, iTunes, etc supposedly have.

    Safari is now using 1.01 GB of memory. :D And that's not from having 100 windows open or anything. I usulaly have a few windows open with a few tabs each most of the time. But it's just the size to which Safari has grown. It started out much less. Under 100mb I think.

    iTunes is up to 280mb from 50mb and I believe it was even higher earlier in the day somewhere in the 330mb range.

    I have 4 gigs of RAm on my aluminum iMac, but now I have only 58mb of free memory left!!!

    When memory runs out what will be the result? Is Safari just using a gig of memory because it can??? Will this slowdown my system? Or will Safari and/or iTunes give up memory starting with the oldest data first? Am I reinventing the wheel here? What will this test or observation prove?

    Updates to follow.
     
  2. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #2
    Are you using Safari 3 or Safari 4 beta? The behavior should be very different between those versions.
     
  3. clevin macrumors G3

    clevin

    Joined:
    Aug 6, 2006
    #3
    maybe you can do some test urself and let us know the comparative results?:D

    I haven't heard anything in webkit's develope addressing the memory leak issue, but would be good to see some real world test...
     
  4. patrickq macrumors member

    Joined:
    Mar 23, 2005
    #4
    I'm using Safari 3.0.4 and if I try to leave it open for more than a few days it slows everything down (Pages etc). So, I guess it's a problem Apple can't resolve? I had the same with earlier version of Safari.
     
  5. clevin macrumors G3

    clevin

    Joined:
    Aug 6, 2006
    #5
    few days might be a bit out of the range of most people's usage.

    just open 6 tabs, with normal websites, such as yahoo. wait for two hrs, whats the number?

    since u are using safari 3.x, maybe u can do us a favor, after above mentioned test, install safari 4b, re-run the test again, and get a number.

    ....
     
  6. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #6
    I'm a WebKit developer :)

    There were a lot of memory usage improvements that went into Safari 4*. As usual, if you can find a specific set of steps that causes very high memory usage (say, more than 400MB) with the latest version, please file bugs at http://bugs.webkit.org or ping me about it.


    *the precise-terminology-loving developer side of me feels compelled to point out that most of them (and in particular most of the biggest ones) were not actually leak fixes. Cache size calculation fixes, data structure size reduction, and using purgable memory all had bigger impacts than fixing leaks.
     
  7. clevin macrumors G3

    clevin

    Joined:
    Aug 6, 2006
    #7
    do you guys compile any data on this issue? is it publicly accessible?
     
  8. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #8
    Other than one Node change I wasn't really involved in memory usage stuff. Try grepping the changelog for "membuster" though, it should turn up a lot of the changes. There were also a lot of commits along the lines of "saves xyz bytes on abc", so searching for "saves" might turn up some more.

    A lot of the testing, sadly, is apple-internal, which I only know about from occasional mentions on #webkit :(

    http://trac.webkit.org/changeset/39228 was probably the most important change.
    http://trac.webkit.org/changeset/38635 was also a big one
     
  9. DoFoT9 macrumors P6

    DoFoT9

    Joined:
    Jun 11, 2007
    Location:
    Singapore
    #9
    SURELY you must know that Mac OS X likes to keep a lot of things in memory so that you can return to it quicker>?< thats what RAM is for! no need to have a whole bunch of it free and wait while everything loads :|

    i leave safari on for weeks and never experience slow downs... i dont know what your talking about.
     
  10. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #10
    DoFoT9, there's a difference between extensive caching and incorrect caching. Safari 3 fails to take into account part of the size of cached objects, resulting in two unfortunate side effects: arbitrary cache growth, and a bias towards caching small objects. Add to that the fact that it doesn't use purgable memory (a way of marking memory for the system to reclaim when there's memory pressure) and it's not so good.
     
  11. DoFoT9 macrumors P6

    DoFoT9

    Joined:
    Jun 11, 2007
    Location:
    Singapore
    #11
    ok well said, thats enough for me to know when to shutup.

    all i know its, when my memory is getting full (which is always does on 2GB of RAM, got 1.5gb of swap and page files after a few days of use) all i do it open up iFreeMem and hit "free memory" and MOST of it comes back.
     
  12. trip1ex thread starter macrumors 68000

    Joined:
    Jan 10, 2008
    #12
    With the all the new Apple releases yesterday I forgot about this.

    I'm using Safari 4.

    My test kind of crashed on me. :)

    I'm not sure why I didn't notice, but after I posted this I noticed my system was at 1.2 gb of inactive memory in addition to the 38mb of free memory.

    And so I had a ways to go before Safari would get big enough to test whether it cleanly gives memory back to other programs.

    And so I got impatient and started opening other programs to take care of that 1.2gb of inactive memory. And my system crashed (froze) while all those programs were opening. I problem should have eased the system into opening those programs instead of just clicking on them all at once.

    So I'm still not sure whether Safari gobbles memory on purpose or on accident.

    I did go back to pages in my history (since the computer was last booted up) to see if they would load super quick and I guess that was non-clusive. My thought was these pages would still be in RAM somewhere due to amount of memory Safari was now using (1gig) and Safari could quickly access them.

    I'm going to do another test soon. Safari is back up to using 470mb memory already. I'm going to do some Googling too.
     
  13. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #13
    Interesting. I'd love to know a) whether you have any Safari addons installed, and b) if you can pin down a particular pattern of sites or actions that leads to memory growth.
     
  14. xilni macrumors member

    xilni

    Joined:
    Jan 16, 2009
    Location:
    Washington, DC/Toronto, ON
    #14
    I was wondering whether Quitting an application and restarting could serve as a temporary fix to a memory leak prone application?
     
  15. DoFoT9 macrumors P6

    DoFoT9

    Joined:
    Jun 11, 2007
    Location:
    Singapore
    #15
    probably not.
     
  16. tkermit macrumors 68030

    tkermit

    Joined:
    Feb 20, 2004
    #16
    Am I missing something? Of course it would. Once the application quits, all its used memory is freed?! Therefore reopening the app makes you start with a blank slate again.
     
  17. kolax macrumors G3

    kolax

    Joined:
    Mar 20, 2007
    #17
    Well if the memory leaks start to cause problems after long periods of use (hours/days) then it would be a temporary fix. Depends how quickly the memory leaks mount up though..
     
  18. DoFoT9 macrumors P6

    DoFoT9

    Joined:
    Jun 11, 2007
    Location:
    Singapore
    #18
    OSX keeps a whole bunch of stuff in RAM even though you still quit an application, yes it may free a "tad" bit of memory but not all... ever wondered why an application opens up quicker just after you quit it then just after youturned on the computer??
     
  19. clevin macrumors G3

    clevin

    Joined:
    Aug 6, 2006
    #19
    maybe the system module used by that app is not completely sink to the bottom of the queue yet, but thats totally different idea than what people here are talking about.

    when a session ends, the user level app should give back all the memory it used. we are not talking about what fundamental system level modules are operated.

    for example, when u run safari for quite a while, say, u see a 450MB memory usage of the safari in activity monitor, then you quit the app, are you saying there is negligible percentage of that 450MB will be freed?
     
  20. tkermit macrumors 68030

    tkermit

    Joined:
    Feb 20, 2004
    #20
    What's with your rhetorical questions? What you say doesn't contradict my previous answer. Fact is, that the memory is freed and therefore available for other programs again, which is uncertain or not the case at all if Safari is still running. I don't see, why only a "tad bit of memory, but not all" should be freed upon exit. As far as I know applications opening quicker only profit from memory not having been overwritten/reused yet (edit: or some other kind of caching going on there).

    edit: beat to it.
     
  21. DoFoT9 macrumors P6

    DoFoT9

    Joined:
    Jun 11, 2007
    Location:
    Singapore
    #21
    ok caught me out. what i should of said is that yes the memory is "freed", but essentially it still lies within memory, not as "active" memory but "inactive" memory. thats why the apps can restart quicker etcetc.

    i use rhetorical questions because i do. put up with it :p
     
  22. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #22
    Yes, it would. Exiting a process frees all memory assigned to it. Note however that this doesn't necessarily include memory that the system was using on its behalf, such as disk and dyld caches. Those should be managed by the OS, although how good a job it does is questionable.
     
  23. clevin macrumors G3

    clevin

    Joined:
    Aug 6, 2006
    #23
    i will caught u out on that whenever i see it :p

    anyway, the reason for not using that is

    1. it generates bad taste.
    2. it give reader the impression that you don't really know it such that you are making a vague statements. you might well know what you mean, but the impression is not under your control.

    thats why I suggest not using rhetorical statement, as well as analogues, so many peopls think they are so smart, and use analogues that only they can understand and expect others to follow them. ...lol
     
  24. DoFoT9 macrumors P6

    DoFoT9

    Joined:
    Jun 11, 2007
    Location:
    Singapore
    #24
    hahahaha ok fair enough. ill try not to use them then. mostly if i dont know a question i will ask it rhetorically, because that way if im wrong the person can see that im not 100% sure, and if im right they have to say im right :) win-win situation lol.

    thanks for the heads up.
     
  25. tkermit macrumors 68030

    tkermit

    Joined:
    Feb 20, 2004
    #25
    I don't doubt the veracity of the OP's report, at all. Fortunately I, myself, can report that, so far, I have been pleasantly surprised by Safari 4's memory management.
    It was usual for Safari 3 to quickly reach the 700mb range for me. From there it would not reduce its memory footprint significantly even when no more Safari windows were open and other apps neded memory. It had a tangible effect on the operation of other applications and Safari itself would slow down significantly after a while.

    In the few days since S4's release my experience has been, that it uses less memory overall, seldomly going up to even 400MB or above. It also seems to continually try to reduce its footprint again. After days of operation it sometimes actually goes back down to under 200MB for me, after all open windows have been closed. I also feel, that there is less performace degradation, but of course this is a very subjective measure...

    Congratulations to anyone involved with achieving this!
     

Share This Page