SwapFiles....how can i delete?

Discussion in 'Mac Help/Tips' started by beatle888, Feb 14, 2003.

  1. macrumors 68000


    Feb 3, 2002
    hello. i heard that swapfiles can slow your
    system down if they accumulate. and what
    i was wondering was...is there a way to delete
    the swap files....say after i close photoshop?
    i know i can restart but thats sorta anti osx :D

    thanks for your help.
  2. macrumors 6502a


    Feb 13, 2002
    the swap file can be found in (your hard drive)>Private>var>vm

    It is in an invisible directory so you will either have to make all of your files visible, or delete it directly from the terminal.

    You can also find it by pressing command-f in the finder then type 'swap' in the search window and under the add criteria droplist choose visibility and select all. Then press search and it should give you the swap file probably named 'swapfile0'.

    As the file is only available to the root user, you will have to delete it using the sudo command in the terminal or by using an app like Force Delete.
  3. thread starter macrumors 68000


    Feb 3, 2002
    so if after having a lot of applications open
    and i have like four swap files, it would be
    safe to trash the files after closing all of the

    wouldnt that be like restarting in a sense...i would just be purging the vm's. but without
    the hassle of restarting. its strange how these
    swap files doent delete themselves. anyway
    im gonna check out Force Delete..thanks alot.

  4. macrumors G3

    Jul 23, 2002
    Sol III - Terra
    No, it isn't safe to delete these files, not if the files are in active use. Which they could be, even if the system in question has no user applications running.

    Do not force delete them. This only leads to problems. And do you really have more than one swap file sitting around?

    And even if you delete the files, don't be surprised if you don't get the diskspace back until you reboot the system.

    One experiment to try if you have more than one swapfile is to reboot the system and see how many you have after the reboot. If it is only one (or none), you're better off letting Mac OS manage the swapfiles.
  5. thread starter macrumors 68000


    Feb 3, 2002
    hello, i have five hundred and twelve megs of
    ram on my ti. i usually have about four or five
    swap disks after pushing around some
    photoshop files. this is not uncommen
    condisdering photoshop requires five times the
    amount of ram as the file size. obviously one
    might need to use scratch disk space. sooooo
    after awhile i do tend to have atleast four swap
    files....but the system NEVER deletes them,
    even after i quit all applications and just let it
    sit there. :( it sucks, i dont want to have to
    restart my system just to clear the swap files.

    AND supposedly having a lot of swap files slows
    your computer down.

    so are you saying that i shouldnt have more
    then one swap file? thats strange, i hope that
    nothings wrong with my system. i guess i'll
    stop throwing the away.
  6. macrumors G3

    Jul 23, 2002
    Sol III - Terra

    Do the number of swapfiles get reduced after restarting the system? I just went through the OS X startup scripts, and it does remove the old swapfiles when the system starts up.

    If so, that's your answer, let the system manage the swapfiles itself.

    Where a person needs a lot of swap space, then partitioning the disk to have a swap partition of the right size would be a good idea.
  7. macrumors newbie

    Dec 8, 2002
    How about changing the size of a swap space allowed to use ?

    can you do that :confused:
  8. macrumors G3

    Jul 23, 2002
    Sol III - Terra
    Looking at the startup scripts, it looks like it is possible, but if you edit the script and mess it up, you're going to have problems.

    So be careful if you try it. I have no idea what the effect of changing the parameters for the swapping/swapfiles is, so I am not going to give directions for changes.
  9. thread starter macrumors 68000


    Feb 3, 2002

    yes but i dont want to have to restart just
    to regain performance from my system.
    i was told when these files add up it slows
    performance. oh well, i can deal.

    thanks for your reply.
  10. macrumors G3

    Jul 23, 2002
    Sol III - Terra
    Look at it this way...

    If you're causing that many swapfiles to be generated, the odds are you're going to be doing the same thing again later. So removing them would be a waste of your time and the system would have to regenerate them.

    Leave them be. :D
  11. macrumors 603


    Feb 2, 2002
    Bear's right, just leave them alone. If you really want, you can move them to another disk/partition to keep defragmenting to a minimun (some say that putting them on another disk speeds performance, it hasn't made too much different on my system). You cannot change how much space swapfiles use, but you can change the location of them.

    Here's the short, sweet answer. If you don't want swap files, go buy a lot more RAM. Swap files are used only when there's not enough physical RAM to handle everything. The performance loss comes from simply using swap files, not having them on your disk later--

    deleting them may actually cause performance problems, as the system has to run through the commands used to create the files every time you delete them. And if the swapfiles are being used even a tiny bit, you won't know it, and deleting them could cause some massive problems in any programs running--


Share This Page