Huge Space gains after restart.

Discussion in 'macOS' started by jonparadise, Oct 24, 2007.

  1. jonparadise macrumors member

    Joined:
    Nov 5, 2005
    Location:
    London, UK
    #1
    I'm having one of those 'clear out' days so that I can get rid of alot of crap off my system before backing up to install Leopard.

    One thing that puzzles me, hopefully one of you may be able to answer.

    Whenever I restart my computer, I gain around 1.4GB of hard disk space.

    This seems to be like an awful lot.

    I could maybe understand if it was due to not being restarted for a long time, but I only did an 'Onyx' and restart 2 days ago!

    Any theories would be appreciated.
     
  2. R.Youden macrumors 68020

    R.Youden

    Joined:
    Apr 1, 2005
    #2
    Sometime applications will create small text files (like .plist files or .log files). Sometimes these files can get into a 'run-away' state and they just get bigger and bigger.

    Try using WhatSize. This is great for finding out what is taking up all the space on your mac. If you have iLife installed and don't use Garageband or iDVD or iMovie then you can delete all the templates etc and you save loads of space.

    Also try XSlimmer and Monolingual.

    All great space saving apps!
     
  3. xUKHCx Administrator emeritus

    xUKHCx

    Joined:
    Jan 15, 2006
    Location:
    The Kop
    #3
    How much ram do you have. There s a fle called sleepimage or something similar that is approxnmately equal to the ammount of ram you have in your system, thsa gets cleaered after a restart. (Well on my system at least)
     
  4. Deej macrumors regular

    Joined:
    Apr 25, 2005
    Location:
    UK
    #4
    Does the useage creep back up again? It could be swapfile / virtual memory ...
     
  5. R.Youden macrumors 68020

    R.Youden

    Joined:
    Apr 1, 2005
    #5
    WOW, didn't know about that!
     
  6. sanford macrumors 65816

    Joined:
    Jan 5, 2003
    Location:
    Dallas, USA
    #6
    It is swapfile and sleep image.
     
  7. xUKHCx Administrator emeritus

    xUKHCx

    Joined:
    Jan 15, 2006
    Location:
    The Kop
    #7
    Can't remember if I cause this to happen by messing around with settings in terminal or if this is the default behaviour. It is found in /private/var/vm if you want to see its behavour on your system.
     
  8. R.Youden macrumors 68020

    R.Youden

    Joined:
    Apr 1, 2005
    #8
    Bloody Hell!!

    There are 4 swapfiles, totaling about 4GB, what is the easiest way to delete them and is it safe to do so?
     
  9. sammich macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #9
    I'm am pretty certain that it isn't a sleep image. The sleep image is reserved space on the main hard drive. If it is removed everytime you restart then what if you had say 2 gig of ram = 2gig for sleep image, you use some of that space, and you now have less than 2 gigs on hdd free? Then you put the laptop to sleep? Then what?

    No, the space you are 'getting back' is simply the swap space that has been used by the system after you ran out of ram (swap memory is stored on the hard drive, that is when when you run out of ram, your computer will slow down and you will hear the hard drive 'seek' very often). I usually have parallels running and my swap space reaches 1.5gigs fairly often. Restarting gets rid of it, and you start at 64 megs of swap space, reclaiming the 1.4375gigs.
     
  10. Deej macrumors regular

    Joined:
    Apr 25, 2005
    Location:
    UK
    #10
    This is what I have in that directory

    -rw------T 1 root wheel 2G Oct 24 12:47 sleepimage
    -rw------T 1 root wheel 64M Oct 11 19:08 swapfile0
    -rw------T 1 root wheel 64M Oct 12 11:19 swapfile1
    -rw------T 1 root wheel 128M Oct 17 15:43 swapfile2
    -rw------T 1 root wheel 256M Oct 17 15:44 swapfile3
    -rw------T 1 root wheel 512M Oct 17 15:57 swapfile4


    This is on a Macbook with 2Gb Ram (which would tie in quite nicely with the sleepimage file :D )
     
  11. sanford macrumors 65816

    Joined:
    Jan 5, 2003
    Location:
    Dallas, USA
    #11
    Sleep image doesn't seem to be reserved until you sleep the first time. So run, sleep, lose space to sleep, reboot, regain space until you sleep again.

    Oh, and on a UNIX system swaps gets reserved along the way, not necessarily only if you run out of RAM. Some systems keep a swap = to total system memory reserved even if never get near max RAM usage.
     
  12. sanford macrumors 65816

    Joined:
    Jan 5, 2003
    Location:
    Dallas, USA
    #12
    Restarting should erase your swaps as it's part of the shut down process. It's typically safe to just delete them; if they are in active use, the OS won't let you empty them from the trash, and if they're not active it will just recreate then ones it needs. But YMMV. And they're just going to come back.
     
  13. sammich macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #13
    Deleting the swapfiles is akin to taking a stick of ram out of your computer whilst it is running.

    The only way to rid yourself of these swapfiles is either do a restart, get more ram (usually involves a restart:eek:), or if you manage to free up a lot of memory by closing apps that hog ram, the swapfiles will eventually (it takes some random, very long time) shrink away. Perhaps apple will have fixed this in leopard, more active purging of swapfiles back to ram?
     
  14. sanford macrumors 65816

    Joined:
    Jan 5, 2003
    Location:
    Dallas, USA
    #14
    See above: if they're in use, i.e. the active swaps, when you try to empty the trash, the OS won't let you. It's pretty fail-safe. Revise your analogy to: trying to yanking a stick of RAM stuck in the slot out of your computer while it's running. And it's stuck but good.
     
  15. Deej macrumors regular

    Joined:
    Apr 25, 2005
    Location:
    UK
    #15
    Just to further this experiment, I've just rebooted, and this is what I have now :)


    -rw------T 1 root wheel 2G Oct 24 12:47 sleepimage
    -rw------T 1 root wheel 64M Oct 24 13:18 swapfile0


    Hope that helps.
     
  16. sammich macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #16
    Nope. The sleep image seems to be reserved the instant you boot up the system for the first time (like right after a full install of the OS). Why? I installed Tiger on an external hdd, did not put it to sleep, and found a sleep image in the /var/vm folder.

    More convincingly, why is my sleepimage older than my uptime on my computer?
     
  17. sanford macrumors 65816

    Joined:
    Jan 5, 2003
    Location:
    Dallas, USA
    #17
    Testing...
     
  18. sammich macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #18
    If you're digging around hidden directories on your computer using terminal (ls -l) i'm sure they have heard of sudo bash. There are many ways to skin a cat (sorry:D), especially from the terminal.
     
  19. sanford macrumors 65816

    Joined:
    Jan 5, 2003
    Location:
    Dallas, USA
    #19
    Well, now, yeah on that point, to poster above (not sammich): stay the heck out of Terminal! I figured he was using something like WhatSize? and noticed the swaps.

    And as for the sleep image: you are correct, brother, created on boot. Along with a brand new 64MB swap (I have a 2GB system). Also for poster above, and not you, sammich: you can't get rid of all your swaps; (most?) UNIX systems require at least a little tiny swap, period, ergo the 64MB swap created when I boot my 2GB system. I wouldn't mess with your swaps. They're there for a reason, and they're just going to come back, anyway as the OS sees fit. Now sometimes you can get 4GB log files because of randomness, they don't for some reason clear on restart, or because you never have your Mac on and awake at the right time -- usually in the middle of the night -- for the automated system clean-up jobs to run. Logs you can safely delete. The OS will just create new ones.
     
  20. Deej macrumors regular

    Joined:
    Apr 25, 2005
    Location:
    UK
    #20
    What's wrong with Terminal? I use it all the time! :)
     
  21. sammich macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #21
    I use scissors all the time too! :p

    Now, just out of curiosity, I'm going to delete a swapfile.*

    Later...
    Okay, my curiosity is satisfied. But deleting swapfiles doesn't seem to have an immediate effect. I ran everything, iphoto, pages, numbers, keynote, parallels (booted in to winxp), itunes, photoshop, safari and it racked up 1gig in swapfiles. I deleted them, then what? Nothing happened, just like normal.

    The only way I can explain this is that, deleting the swapfiles is okay as long as they aren't overwritten by the system (don't count on it). The OS still has the pointer to the location of the swapfile on the hdd, so it can access it like it is still visible. I haven't restarted or anything.

    Menumeters screenshot, look down the bottom.
     

    Attached Files:

    • mem.png
      mem.png
      File size:
      53 KB
      Views:
      17
  22. jonparadise thread starter macrumors member

    Joined:
    Nov 5, 2005
    Location:
    London, UK
    #22
    Gosh, thanks for the replies guys.

    So it sounds like it's just the system doing it's thing and nothing sinister.

    I've got 2 GB Ram.
     
  23. dr_lha macrumors 68000

    Joined:
    Oct 8, 2003
    #23
    Only people who know how the Terminal works, should use it. People who ask questions like "Can I just delete these swap files", most likely don't fit into that category! :D
     
  24. Deej macrumors regular

    Joined:
    Apr 25, 2005
    Location:
    UK
    #24
    Heh - true enough!! :D

    Of course even if they *do* use Terminal, only the "REAL MEN" use vi ;) :D
     
  25. dr_lha macrumors 68000

    Joined:
    Oct 8, 2003
    #25
    Lets not start that flame war. ;) *cough*EMACS*cough*
     

Share This Page