I need a routine that will temporarily drive the
available physical memory to zero.


Posted on 2002-05-16 07:55:23 by Ewayne
I believe there is such a tool in the PSDK,
but I have never used it. It's in the tools
directory, iirc.
Posted on 2002-05-16 08:00:41 by bitRAKE
How about calling VirtualAlloc(NULL, 0x1000, MEM_COMMIT, PAGE_READWRITE) in a loop until it fails?

aweX <-
Posted on 2002-05-16 08:23:48 by aweX
Thanks bitRAKE and aweX.

To aweX,

VirtualAlloc doesn't seem to work, but HeapAlloc
then HeapReAlloc works.

But it has some nasty side effects when the
physical memory reaches zero it takes Windows a
couple of seconds to recover and then after doing
it a few times my swap file fills up.

If you could look at my post on the IDE forum
under CreateProcess Help! you will see what I'm
trying to accomplish.

Posted on 2002-05-17 09:00:02 by Ewayne

There is an old SDK tool called STRESS that works in win95 but I don't know if it works in NT/2k/XP.

It is designed to do what you are after.


Posted on 2002-05-17 09:26:26 by hutch--
Thanks Hutch,

All I need it for is Win98x and maybe XP Hone,
there is not a problem with NT, Win2k, or XP Pro.

I will try to find it.

Did you look at my post on the IDE's forum under
CreateProcess Help! you will see what I'm
trying to accomplish.

Maybe there is a better way.


Posted on 2002-05-17 09:44:37 by Ewayne
To reduce free physical memory to 0 it should suffice to enlarge size of locked memory to (almost) the size of physical memory. In theory VirtualLock should do that lock job, but it doesn't do that at least in Win9x (proved simply by locking a memory region larger than physical memory size, which should always fail but doesnt in Win9x). But DPMI functions (0x602) work with all win9x versions.
Posted on 2002-05-18 01:23:57 by japheth