Why does Safari leak so much memory?

Discussion in 'Mac Apps and Mac App Store' started by Aika, Oct 27, 2006.

  1. Aika macrumors regular


    Apr 7, 2006
    Safari takes up 500MB of ram (physical) quite frequently, requiring a reload of the application to stop my system getting any more sluggish. Camino never seems to exceed 100MB of ram (but sadly is a bit ropey when it comes to flash and wmv). Why can a small team get it right whilst Apple fail so miserably at optimising their software (iTunes is similarly bad when using coverflow view)? I like Safari enough to have paid for Saft and I love how fast it is at rendering pages but too often it brings my system to its knees.

    So yeah, I guess my main questions are:

    1) Has Safari 3.0 fixed the memory leaks?
    2) What causes such extreme leaks? Shoddy code?

    Ta :)
  2. DXoverDY macrumors 6502a

    Apr 19, 2005
    They aren't "leaks" per say. It caches the pages in ram... So that really just invalidates your other questions.
  3. pimentoLoaf macrumors 68000


    Dec 30, 2001
    The SimCity Deli
    How much RAM do you have in your system? If it's 512mb, then Mail will have to use virtual memory (the sluggishness) to compensate.

    How much mail do you still have in your inbox or various folders? That can have an effect as well.
  4. darkwing macrumors 65816

    Jan 6, 2004
    Safari leaks memory because it's running instead of Firefox.
  5. Aika thread starter macrumors regular


    Apr 7, 2006
    Is this a special feature no other browser uses? Like I said, no other browser uses more than about 100MB (Camino is using 46MB right now for me) whilst Safari uses five times that. If I quit and reopen Safari it will go from using 500MB to about 60MB (with the same tabs and all back and forwards functions present and correct courtesy of Saft) so if it's not a memory leak what is it?

    I have 2GB of ram so it's not my system that's the bottleneck.
  6. Catfish_Man macrumors 68030


    Sep 13, 2001
    Portland, OR
    Actually firefox is famous for gobbling ram as well.
    That said, there is a real reason, and it's not a good one. Safari's cache, prior to the code about two weeks ago, did not correctly cap its size. This should be fixed in the nightly builds of webkit, although there's still a few smaller leaks (as there are in basically all nontrivial software).
  7. DXoverDY macrumors 6502a

    Apr 19, 2005
    You don't understand. Leaks are memory you never get back until you restart. Not restart the app, but restart the OS.

    Your issue is not "leaked" memory. It's Safari's caching.
  8. Sayer macrumors 6502a


    Jan 4, 2002
    Austin, TX
    Under the protected *virtual* memory space model, this is not true. Any memory "leaked" is unusable until the application is terminated, along with its virtual address space/pages.

    All of Mac OS X uses excessive caching to speed things up, such as menu drawing. You can see the effect *not* caching has in applications *cough* Adobe *cough* that build their menu from scratch every single time you open one, and how sluggish the app's menus can be.

Share This Page