Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - VBscript to generate memory load

Reply
 
Old 05-12-2009   #1 (permalink)
Star


 
 

VBscript to generate memory load

Hi...

I'd like some help, is it possible to write a vbscript that can
generate some memory load on a server.

I know there's a vbscript called cpubusy.vbs which can be used to
generate cpu load on a server. Is there something equivalent for RAM
load I can use for testing....


Cheers Thanks

My System SpecsSystem Spec
Old 05-12-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: VBscript to generate memory load


"Star" <momo2804@xxxxxx> wrote in message
news:3bfab76f-5d3e-417a-95d8-ae017304df9e@xxxxxx
Quote:

> Hi...
>
> I'd like some help, is it possible to write a vbscript that can
> generate some memory load on a server.
>
> I know there's a vbscript called cpubusy.vbs which can be used to
> generate cpu load on a server. Is there something equivalent for RAM
> load I can use for testing....
>
>
> Cheers Thanks
You could repeatedly read some data into memory, e.g. like so:

Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim aData(10)
Set oFile = oFSO.OpenTextFile("e:\test.bin")
aData(0) = oFile.ReadAll
oFile.Close
For i = 1 To 9
aData(i) = aData(0)
Next
MsgBox "Click OK to exit"

The following command will instantly create a disk file of any size, e.g. 10
or 100 MBytes:

fsutil file createnew test.bin 10000000


My System SpecsSystem Spec
Old 05-12-2009   #3 (permalink)
Al Dunbar


 
 

Re: VBscript to generate memory load


"Pegasus [MVP]" <news@xxxxxx> wrote in message
news:uUvahQt0JHA.1432@xxxxxx
Quote:

>
> "Star" <momo2804@xxxxxx> wrote in message
> news:3bfab76f-5d3e-417a-95d8-ae017304df9e@xxxxxx
Quote:

>> Hi...
>>
>> I'd like some help, is it possible to write a vbscript that can
>> generate some memory load on a server.
>>
>> I know there's a vbscript called cpubusy.vbs which can be used to
>> generate cpu load on a server. Is there something equivalent for RAM
>> load I can use for testing....
>>
>>
>> Cheers Thanks
>
> You could repeatedly read some data into memory, e.g. like so:
>
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> Dim aData(10)
> Set oFile = oFSO.OpenTextFile("e:\test.bin")
> aData(0) = oFile.ReadAll
> oFile.Close
> For i = 1 To 9
> aData(i) = aData(0)
> Next
> MsgBox "Click OK to exit"
>
> The following command will instantly create a disk file of any size, e.g.
> 10 or 100 MBytes:
>
> fsutil file createnew test.bin 10000000
That would seem to create a "disk load" rather than a "RAM load", though,
wouldn't it?

Of course, it is not clear what would actually constitute a "load" on
memory. Your 2G of memory is completely full of some combination of bit
values. It does not matter what these values are, as it takes no more energy
to maintain ones as it takes to maintain zeros.

You could write a script to change a bunch of these values, but the main
effect would seem to be the "CPU load" involved in making those changes.

What is it that you are trying to accomplish here?

/Al


My System SpecsSystem Spec
Old 05-12-2009   #4 (permalink)
Pegasus [MVP]


 
 

Re: VBscript to generate memory load


"Al Dunbar" <alandrub@xxxxxx> wrote in message
news:uMrVxnw0JHA.140@xxxxxx
Quote:

>
> "Pegasus [MVP]" <news@xxxxxx> wrote in message
> news:uUvahQt0JHA.1432@xxxxxx
Quote:

>>
>> "Star" <momo2804@xxxxxx> wrote in message
>> news:3bfab76f-5d3e-417a-95d8-ae017304df9e@xxxxxx
Quote:

>>> Hi...
>>>
>>> I'd like some help, is it possible to write a vbscript that can
>>> generate some memory load on a server.
>>>
>>> I know there's a vbscript called cpubusy.vbs which can be used to
>>> generate cpu load on a server. Is there something equivalent for RAM
>>> load I can use for testing....
>>>
>>>
>>> Cheers Thanks
>>
>> You could repeatedly read some data into memory, e.g. like so:
>>
>> Set oFSO = CreateObject("Scripting.FileSystemObject")
>> Dim aData(10)
>> Set oFile = oFSO.OpenTextFile("e:\test.bin")
>> aData(0) = oFile.ReadAll
>> oFile.Close
>> For i = 1 To 9
>> aData(i) = aData(0)
>> Next
>> MsgBox "Click OK to exit"
>>
>> The following command will instantly create a disk file of any size, e.g.
>> 10 or 100 MBytes:
>>
>> fsutil file createnew test.bin 10000000
>
> That would seem to create a "disk load" rather than a "RAM load", though,
> wouldn't it?
Reading ten copies of a 100 MByte file into memory would IMHO load 1 GBytes
of data into memory, with Windows deciding whether it should go into RAM or
into the Paging File.


My System SpecsSystem Spec
Old 05-12-2009   #5 (permalink)
T Lavedas


 
 

Re: VBscript to generate memory load

On May 12, 10:52*am, "Pegasus [MVP]" <n...@xxxxxx> wrote:
Quote:

> "Al Dunbar" <aland...@xxxxxx> wrote in message
>
> news:uMrVxnw0JHA.140@xxxxxx
>
>
>
>
>
Quote:

> > "Pegasus [MVP]" <n...@xxxxxx> wrote in message
> >news:uUvahQt0JHA.1432@xxxxxx
>
Quote:
Quote:

> >> "Star" <momo2...@xxxxxx> wrote in message
> >>news:3bfab76f-5d3e-417a-95d8-ae017304df9e@xxxxxx
> >>> Hi...
>
Quote:
Quote:

> >>> I'd like some help, is it possible to write a vbscript that can
> >>> generate some memory load on a server.
>
Quote:
Quote:

> >>> I know there's a vbscript called cpubusy.vbs which can be used to
> >>> generate cpu load on a server. Is there something equivalent for RAM
> >>> load I can use for testing....
>
Quote:
Quote:

> >>> Cheers Thanks
>
Quote:
Quote:

> >> You could repeatedly read some data into memory, e.g. like so:
>
Quote:
Quote:

> >> Set oFSO = CreateObject("Scripting.FileSystemObject")
> >> Dim aData(10)
> >> Set oFile = oFSO.OpenTextFile("e:\test.bin")
> >> aData(0) = oFile.ReadAll
> >> oFile.Close
> >> For i = 1 To 9
> >> aData(i) = aData(0)
> >> Next
> >> MsgBox "Click OK to exit"
>
Quote:
Quote:

> >> The following command will instantly create a disk file of any size, e..g.
> >> 10 or 100 MBytes:
>
Quote:
Quote:

> >> fsutil *file createnew test.bin 10000000
>
Quote:

> > That would seem to create a "disk load" rather than a "RAM load", though,
> > wouldn't it?
>
> Reading ten copies of a 100 MByte file into memory would IMHO load 1 GBytes
> of data into memory, with Windows deciding whether it should go into RAM or
> into the Paging File.
Why do they need to be read from a file? I think that was Al's point,
at least in part. He also suggests that zeros are as good as ones, so
just defining a large array would occupy the memory just as well.

Finally, I reinforce his question about what the OP is trying to
accomplish - since as you point out - Windows may or may not actually
use RAM for the transaction, anyway.

Tom Lavedas
***********
My System SpecsSystem Spec
Old 05-12-2009   #6 (permalink)
Pegasus [MVP]


 
 

Re: VBscript to generate memory load


"T Lavedas" <tglbatch@xxxxxx> wrote in message
news:b265d27d-4b96-47ff-ad6f-39561603add3@xxxxxx
On May 12, 10:52 am, "Pegasus [MVP]" <n...@xxxxxx> wrote:
Quote:

> "Al Dunbar" <aland...@xxxxxx> wrote in message
>
> news:uMrVxnw0JHA.140@xxxxxx
>
>
>
>
>
Quote:

> > "Pegasus [MVP]" <n...@xxxxxx> wrote in message
> >news:uUvahQt0JHA.1432@xxxxxx
>
Quote:
Quote:

> >> "Star" <momo2...@xxxxxx> wrote in message
> >>news:3bfab76f-5d3e-417a-95d8-ae017304df9e@xxxxxx
> >>> Hi...
>
Quote:
Quote:

> >>> I'd like some help, is it possible to write a vbscript that can
> >>> generate some memory load on a server.
>
Quote:
Quote:

> >>> I know there's a vbscript called cpubusy.vbs which can be used to
> >>> generate cpu load on a server. Is there something equivalent for RAM
> >>> load I can use for testing....
>
Quote:
Quote:

> >>> Cheers Thanks
>
Quote:
Quote:

> >> You could repeatedly read some data into memory, e.g. like so:
>
Quote:
Quote:

> >> Set oFSO = CreateObject("Scripting.FileSystemObject")
> >> Dim aData(10)
> >> Set oFile = oFSO.OpenTextFile("e:\test.bin")
> >> aData(0) = oFile.ReadAll
> >> oFile.Close
> >> For i = 1 To 9
> >> aData(i) = aData(0)
> >> Next
> >> MsgBox "Click OK to exit"
>
Quote:
Quote:

> >> The following command will instantly create a disk file of any size,
> >> e.g.
> >> 10 or 100 MBytes:
>
Quote:
Quote:

> >> fsutil file createnew test.bin 10000000
>
Quote:

> > That would seem to create a "disk load" rather than a "RAM load",
> > though,
> > wouldn't it?
>
> Reading ten copies of a 100 MByte file into memory would IMHO load 1
> GBytes
> of data into memory, with Windows deciding whether it should go into RAM
> or
> into the Paging File.
Why do they need to be read from a file? I think that was Al's point,
at least in part.
*** Agreed - reading them from a file is one of several methods.

He also suggests that zeros are as good as ones, so
just defining a large array would occupy the memory just as well.
*** When you say "define", do you mean "declare" or "populate"?
*** If you mean "declare" then we don't know for sure at what
*** time the interpreter grabs the memory.

Finally, I reinforce his question about what the OP is trying to
accomplish - since as you point out - Windows may or may not actually
use RAM for the transaction, anyway.

Tom Lavedas
***********


My System SpecsSystem Spec
Old 05-12-2009   #7 (permalink)
momo2804


 
 

Re: VBscript to generate memory load

Thanks guys for all your replies, actually the reason I'm doing this
is because I'm doing some testing on VMware and I want to stress out
the load on the VMs to see how the VMware will handle when there's
memory among VMs.

Cheers........
My System SpecsSystem Spec
Old 05-12-2009   #8 (permalink)
Al Dunbar


 
 

Re: VBscript to generate memory load


"Pegasus [MVP]" <news@xxxxxx> wrote in message
news:O7Bxogx0JHA.4756@xxxxxx
Quote:

>
> "T Lavedas" <tglbatch@xxxxxx> wrote in message
> news:b265d27d-4b96-47ff-ad6f-39561603add3@xxxxxx
> On May 12, 10:52 am, "Pegasus [MVP]" <n...@xxxxxx> wrote:
Quote:

>> "Al Dunbar" <aland...@xxxxxx> wrote in message
>>
>> news:uMrVxnw0JHA.140@xxxxxx
>>
>>
>>
>>
>>
Quote:

>> > "Pegasus [MVP]" <n...@xxxxxx> wrote in message
>> >news:uUvahQt0JHA.1432@xxxxxx
>>
Quote:

>> >> "Star" <momo2...@xxxxxx> wrote in message
>> >>news:3bfab76f-5d3e-417a-95d8-ae017304df9e@xxxxxx
>> >>> Hi...
>>
Quote:

>> >>> I'd like some help, is it possible to write a vbscript that can
>> >>> generate some memory load on a server.
>>
Quote:

>> >>> I know there's a vbscript called cpubusy.vbs which can be used to
>> >>> generate cpu load on a server. Is there something equivalent for RAM
>> >>> load I can use for testing....
>>
Quote:

>> >>> Cheers Thanks
>>
Quote:

>> >> You could repeatedly read some data into memory, e.g. like so:
>>
Quote:

>> >> Set oFSO = CreateObject("Scripting.FileSystemObject")
>> >> Dim aData(10)
>> >> Set oFile = oFSO.OpenTextFile("e:\test.bin")
>> >> aData(0) = oFile.ReadAll
>> >> oFile.Close
>> >> For i = 1 To 9
>> >> aData(i) = aData(0)
>> >> Next
>> >> MsgBox "Click OK to exit"
>>
Quote:

>> >> The following command will instantly create a disk file of any size,
>> >> e.g.
>> >> 10 or 100 MBytes:
>>
Quote:

>> >> fsutil file createnew test.bin 10000000
>>
Quote:

>> > That would seem to create a "disk load" rather than a "RAM load",
>> > though,
>> > wouldn't it?
>>
>> Reading ten copies of a 100 MByte file into memory would IMHO load 1
>> GBytes
>> of data into memory, with Windows deciding whether it should go into RAM
>> or
>> into the Paging File.
>
> Why do they need to be read from a file? I think that was Al's point,
> at least in part.
> *** Agreed - reading them from a file is one of several methods.
But if one needs to generate a "load" on one component (i.e. memory), then
including another component that can be a bottleneck (i.e. disk I/O) would
tend to reduce the rate at which memory is "loaded". Perhaps.
Quote:

> He also suggests that zeros are as good as ones, so
> just defining a large array would occupy the memory just as well.

Actually, all I meant was that the "stress" or "load" you put on available
memory is no higher when it is ones you are storing than when it is zeros.
But it still comes down to this: what does it mean to place a "load" on
memory? The concept makes no sense to me.
Quote:

> *** When you say "define", do you mean "declare" or "populate"?
> *** If you mean "declare" then we don't know for sure at what
> *** time the interpreter grabs the memory.
Not exactly true. We do know for a fact that [DIM A(999999)] does not
allocate any space for the elements that will make up the array, though it
may allocate space for indexing. If we then define A(555555) to be a large
object, this does not cause any other elements of the array to take on
storage.
Quote:

> Finally, I reinforce his question about what the OP is trying to
> accomplish - since as you point out - Windows may or may not actually
> use RAM for the transaction, anyway.
I would also ask what he means by placing a load on memory.

/Al


My System SpecsSystem Spec
Old 05-12-2009   #9 (permalink)
Al Dunbar


 
 

Re: VBscript to generate memory load


<momo2804@xxxxxx> wrote in message
news:809670f6-677f-4cab-b63e-34da3e881deb@xxxxxx
Quote:

> Thanks guys for all your replies, actually the reason I'm doing this
> is because I'm doing some testing on VMware and I want to stress out
> the load on the VMs to see how the VMware will handle when there's
> memory among VMs.
Do you want to "load" the memory of the host machine, or of the virtual
machines? Does this mean that you want to run a program that "occupies" a
large chunk of memory, therefore reducing the amount available for competing
programs? Or do you want to "exercise" that memory by storing data into it
and then perhaps changing it?

Until you define precisely what it is that is required (i.e or that you mean
by creating a "load" on memory), we are unlikely to come up with a solution.

And, as Tom mentioned a bit earlier, you may not always know what memory
operations windows might be performing on disk and vice-versa. Adding vmware
to the mix is simply adding two more layers of vagueness to the mix.


/Al


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Vista x64 can't load with Memory Remap on. Vista hardware & devices
(Vista 64-bit) Can one somehow "dump" a program's memory (e.g., firefox or chrome) to a file and load after closing a program? Vista file management
How to do No hang up VBScript (nohup for VBScript) VB Script
MS HOTFIX: Memory load is high when you run an application builton the .NET Framework 2.0 PowerShell
Can't load library from memory Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46