TechSpot

Defrag Ram

By Reason
Oct 20, 2003
  1. is it really necessary to defrag your RAM.. someone has told me this is necessary but I'm not sure.. I am running 1 gig of RAM on my comp with no problems at all. I am reluctant to try this if I am having no problems. what do you think?
     
  2. Didou

    Didou Bowtie extraordinair! Posts: 5,899

    If it ain't broke, don't even try to fix it.:blackeye:
     
  3. Th3M1ghtyD8

    Th3M1ghtyD8 TechSpot Paladin Posts: 794

    Defragging Ram is not really possible, the programs simply allocate a chunk of memory large enough to fill your available ram and then deallocate it, in order to make it seem that there is a large block of memory available, but really all that is happening is that any fragments get paged out to your swap file and then paged back in hopefully in complete chunks.

    My Tweaking Program has this option as it was easy to implement, but i am not convinced there are any long term advantages of defragging ram as opposed to simply rebooting.

    Of course in situations where uptime is critical (servers etc.) then it may be a good idea.
     
  4. vassil3427

    vassil3427 TS Rookie Posts: 822

    Are you sure they weren't telling you to defragment your Hard Drive? Defragging your hard drive speeds things up alot....
     
  5. Nic

    Nic TechSpot Paladin Posts: 1,928

    Defragging RAM has no effect, as RAM does not suffer from delays that plague hard drives (i.e. moving disc heads back and forth). Fragmentation is handled automatically by the OS as it allocates and deallocates blocks of memory.
     
  6. Th3M1ghtyD8

    Th3M1ghtyD8 TechSpot Paladin Posts: 794

    Defragging RAM does have some effect, just in 99% of the time it is not worth doing, in critical environments such as servers then defragging memory rather than rebooting is obviously preferable.

    Fragmentation of memory does occur, usually by buggy software which has memory leaks (i.e. where memory is allocated but not deallocated).
     
  7. Nodsu

    Nodsu TS Rookie Posts: 9,431

    Mm.. I would really like some more information about this Th3M1ghtyD8, especially about this defragging thing allowing me to avoid reboots..

    And memory "defragmentation" definently cannot take care of memory leaks, not under any popular OS anyway.
     
  8. Nic

    Nic TechSpot Paladin Posts: 1,928

    Memory leaks are caused by misbehaving software, and defragmenting memory has no effect. I suspect that you are confused because there are some memory defragmenters available, that also claim to release memory from programs that misbehave.

    In my experience, rebooting is the best, and often only, option that works. Everytime you run an application or do anything at all on your PC, memory is being allocated and released. The reason this is required is to allow some software to be granted contiguous blocks of free RAM so that it can operate correctly. It has nothing to do with performance, because all RAM is addressed in the same way, and the pattern of address bits does not affect speed, but consecutive addresses are often required for certain types of data (e.g. arrays) and avoid the overhead of having to store lots of addressing information. This is the type of thing that your OS already takes care of automatically.
     
  9. Th3M1ghtyD8

    Th3M1ghtyD8 TechSpot Paladin Posts: 794

    This Excerpt from a Memory/Disk Speed Tweaking Guide I found on www.Tweak3d.net a while ago.

    All this does is allocate a chunk of memory while the script is running, and then the VB runtimes deallocate it. The Value needs to be set according to the amount of memory you have (i.e. it will probably need increasing in order to be effective if you have 1Gb), but forces any currently unused memory to be paged to the swapfile, thus freeing that memory in order to be used by the rest of the system. i.e. if you are working on a large image file in PSP and then minimize PSP, you can temporarily regain physical memory by swapping currently unused ram out to the pagefile.

    It does actually work (I did some benchmarks when I was implementing it in my tweaking program), but whether it is particularly of use is another issue.
    This is what almost all memory optimiser programs do AFAIK (including stuff like TweakXP Pro etc.).

    By using this method of defragmentation, any memory leaks can be paged out to your swapfile, thus freeing physical memory (since memory leaks will never be accessed again).

    Additionally, this will reduce the (admittedly very small) overhead of trying to allocate memory blocks, as it is quicker to allocate a contiguous block than several uncontiguous blocks.
     
  10. Nodsu

    Nodsu TS Rookie Posts: 9,431

    OOK, DB managed to stick a post before mine..
     
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.