View Single Post
Old 07-23-2007   #2 (permalink)
Andrew McLaren


 
 

Re: Setting virtual memory progrmmatically

"Setting virtual memory progrmmatically" <Setting virtual memory
progrmmatically@discussions.microsoft.com> wrote ...
> I have used VirtualAllocEx().
> It works only when "Automatically manage paging file size for all
> drives" (This option is not there in Windows Xp) is selected in System
> Preference/Performance Options. It doesn't work when "Custom size" is
> selected in System Preference/
> Performance Options(works fine in Windows Xp).


Namaste Sudesh,

When you say "it doesn't work" ... what does GetLastError() report?

And just to be clear - are you really to Commit that memory? Or do you want
to just Reserve it?

The main reason your Commit would fail, would be if there is no backing
store available for the Virtual Memory pages. A popular form of backing
store is the paging file. It's quite possible that on your system, more of
the paging file is being utilised under Vista than it was under XP;
therefore there is no backing store available to commit the memory pages. It
isn't necessarily an error. "Virtual Memory" as seen by a process, and the
paging file on the disk, are two separate and independent concepts, although
closely related. User mode applications typically have no control over the
size of the paging file - in fact, any application which tried to set the
size of the paging file programmatically, would be a very bad design - IMHO.
But not sure that's what you're trying to do ...

Cheers

--
Andrew McLaren
amclar (at) optusnet dot com dot au


My System SpecsSystem Spec