Computer Forum - PC Hardware, Software Forums  

Go Back   Computer Forum - PC Hardware, Software Forums > Computer Hardware Zone > Random Access Memory (RAM)
Register Members List Calendar Search Today's Posts Mark Forums Read

Random Access Memory (RAM) Devoted to system memory of all types, including but not limited to FP, EDO, RD, SD-RAM, DDR SD-RAM and DDRII SD-RAM.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 19/10/06, 12:04
syphus's Avatar
syphus syphus is offline
Administrator
 
Join Date: Oct 2005
Location: Far away
Posts: 2,034
syphus is on a distinguished road
Send a message via ICQ to syphus Send a message via AIM to syphus Send a message via MSN to syphus Send a message via Yahoo to syphus
Memory/Cache Experiment

I was experimenting with Vista today, specifically memory management and how it reacts in extremely depleted memory situations. As a quick and dirty simulation, I wrote the following vb script to just consume as much memory until an error occurs, then exit gracefully.

Code:
on error resume next
dim alloc(32676)
for n = 0 To 32676
alloc(n) = space(102400)
if err.number > 0 then
exit For
end If
next
This is basically doing exactly as those "memory defrag" programs are doing; forcing Windows to dump any cache and flush what it can to the page file. Once done, it exists and frees itself, magically giving you more free memory – but you’re then faced with a sluggish system that has to fetch everything from the page file.

It occurred to me that it's a good way to test if your system is starving for RAM. If you can run the script and don’t notice anything different (even clicking on the start menu, or switching to another minimised program should be a chore), your system is swapping too much and needs more RAM.

To run the script, just copy it to notepad and save it with a .vbs extension (you might need the hide known file extensions option disabled in folder options). The icon should be a blue scroll, provided you’re using Windows 2000 or later, or using Windows ME/9x and have the Visual Basic Runtime and Windows Script Hosting installed. Double click on it. If you have a lot of RAM or a slow CPU, it could take a while. If you’re using Windows 2000 or later, you should be able to see your available physical memory get sucked away to nothing and the size of your page file grow very large from the task manager. When it’s done chewing everything away, it will just stop and close. Your physical memory will return to normal very rapidly, probably higher than it was. Then you’re faced with the laborious swapping process, as the system turns to molasses when you try and do something. If you have enough memory, everything will load back into RAM as you use it, and it will eventually be as if you never did this torture.

For smarter Windows 2000 and later, this does nothing for you. In Windows 98 and earlier it sort of help programs load faster and may even keep them running for longer without a reboot, but I doubt it really. It would probably blue screen Windows ME.

Adding the following line to the end will prevent the script from exiting as soon as it’s done, and thusly not freeing the memory until you click on the Ok box. This is a fun experiment on memory usage for anyone with 1GB or greater.

Code:
msgbox "allocated. Click ok to free"
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Experiment Tom Microsoft Windows Vista 12 03/07/06 19:06
computer memory vacant1uk Desktop Computer Forum 7 29/04/06 18:49
Different Memory mick_f Random Access Memory (RAM) 4 17/03/06 00:13
CPU Cache and FSB fearnot Central Processing Units (CPUs) 2 26/01/06 05:39
memory setting basriucs Random Access Memory (RAM) 2 02/01/06 15:54


All times are GMT +1. The time now is 22:42.


| Laptop Computer Reviews | Earn Cashback on Computer Shopping in UK | Cheap Broadband Bundles

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0
Content Relevant URLs by vBSEO 3.0.0