Defrag Ram

Status
Not open for further replies.

Reason

Posts: 18   +0
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?
 
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.
 
Are you sure they weren't telling you to defragment your Hard Drive? Defragging your hard drive speeds things up alot....
 
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.
 
Originally posted by Nic
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.

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).
 
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.
 
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.
 
This Excerpt from a Memory/Disk Speed Tweaking Guide I found on www.Tweak3d.net a while ago.

Free Up Some RAM!

If you have just run an intensive or specifically large application or game, you know about that groggy feeling your system can have. That's usually because of the leftovers taking up your valuable memory. You can free it, however, by clicking your heels together 3 times and saying: "Let my memory go." Er, I mean, using a program to free that trapped memory. There are many good programs to do this at Tweakfiles.

If you don't want to download a big fancy program, you can actually make one yourself very easily using Visual Basic runtimes (you don't even need VB to do this).

Here's what you do:
Open up Notepad (Start, Run, "notepad" (OK)). Depending on how much memory you have, put the appropriate values in...
Under 128mb Ram:
Mystring = (16000000)

128mb or More:
Mystring = (80000000)

Save it as "Memory.vbe" (including the quotes!). Close as many programs as you can, then run (double click) this handy little script to free your memory whenever your computer is feeling sluggish.

If you have trouble running it, you may need the Visual Basic Runtimes. You can get them here.

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.
 
Status
Not open for further replies.
Back