RE: [GD-Windows] How to determine total physical memory available ?
Brought to you by:
vexxed72
From: Simon O'C. <si...@sc...> - 2004-02-09 00:18:27
|
A follow up in case anyone still needs to do this: I've had a play around with WMI this weekend and it is indeed the way to = go for getting this kind of thing on 2K/XP machines. Win32_PhysicalMemory = gets its info from the system BIOS. For simplicity I've been using VB/VBScript, but the C++ method is the = same, albeit with a lot of extra COM handling.=20 Here's a simple VBS example of returning true physical memory info (to = run it, copy what's below into a text file and give the file a .VBS = extension): For Each Mem in = GetObject("winmgmts:").InstancesOf("Win32_PhysicalMemory") WScript.Echo("Bank=3D" & Mem.BankLabel & " Size=3D" & Mem.Capacity / (1024*1024) & "MB") Next Cheers, Simon O'Connor Programmer @ Acclaim & Microsoft DirectX MVP=20 > -----Original Message----- > From: gam...@li...=20 > [mailto:gam...@li...] On=20 > Behalf Of Simon O'Connor > Sent: 27 January 2004 00:38 > To: gam...@li... > Subject: RE: [GD-Windows] How to determine total physical=20 > memory available ? >=20 >=20 > Although I've not tried it myself, WMI (assuming 2K/XP) seems=20 > to have a few things for getting lots of information about=20 > the hardware - not sure how much of that info is available on=20 > all systems though - I'll give it a try when I get a free=20 > moment - there's a lot of very intriguing stuff you can query=20 > in there such as: >=20 > "Win32_PhysicalMemoryArray" > "Win32_PhysicalMemoryLocation" > "Win32_PhysicalMemory" >=20 > Which seem to have stuff as hardcore as the chip package=20 > type, speed in ns, chip manufacturer, bank layout. >=20 > Simon O'Connor > Programmer @ Acclaim > & Microsoft DirectX MVP =20 >=20 > > -----Original Message----- > > From: gam...@li... > > [mailto:gam...@li...]=20 > On Behalf Of=20 > > Yannick Letourneau > > Sent: 26 January 2004 21:15 > > To: gam...@li... > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > available ? > >=20 > > Both ;-) > >=20 > > Yeah, right now I'm doing as you're suggesting but I still=20 > would like=20 > > to display the right value to the user. I guess I'll have to live=20 > > with it unless I find a better way. > >=20 > > Yannick > >=20 > > -----Original Message----- > > From: Simon O'Connor [mailto:si...@sc...] > > Sent: Monday, January 26, 2004 4:07 PM > > To: gam...@li... > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > available ? > >=20 > >=20 > >=20 > > BTW: > >=20 > > Do you actually need the value for presentation to the user? > >=20 > > Or is this to determine whether the user has enough=20 > physical memory to=20 > > run your game or use advanced memory hungry features? > >=20 > >=20 > > If it's the latter, then you should only really use the value as a=20 > > rough guide (much the same as with total video memory), e.g.: > >=20 > > if (memorysize < 500000000) > > { > > alert( "sorry this game requires a minimum of 512MB" ); > > return; > > } > >=20 > > m_enableMemoryHoggingFeature =3D false; > >=20 > > if (memorysize >=3D 1000000000) > > { > > m_enableMemoryHoggingFeature =3D true; } > >=20 > >=20 > > Of course, you can never assume all of that physical memory=20 > is yours=20 > > to play with anyway (kernel allocations, AGP reservation etc). > >=20 > >=20 > > Simon O'Connor > > Programmer @ Acclaim > > & Microsoft DirectX MVP=20 > >=20 > > > -----Original Message----- > > > From: gam...@li... > > > [mailto:gam...@li...]=20 > > On Behalf Of=20 > > > Yannick Letourneau > > > Sent: 26 January 2004 20:21 > > > To: gam...@li... > > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > > available ? > > >=20 > > > Actually it would be a little more complicated since memory=20 > > can be a=20 > > > sum of different power of 2 (for example if you have one=20 > > memory chip=20 > > > of 128 MB and another of 64 MB totaling 192MB which is=20 > not power of=20 > > > 2). > > >=20 > > > I'd rather not make this kind of assumption myself and let=20 > > the system=20 > > > give me the exact numbers ;-) > > >=20 > > > -----Original Message----- > > > From: Timur Davidenko [mailto:ti...@cr...] > > > Sent: Monday, January 26, 2004 3:16 PM > > > To: gam...@li... > > > Subject: RE: [GD-Windows] How to determine total physical memory=20 > > > available ? > > >=20 > > >=20 > > > I guess System Information tool just rounds this number=20 > to the next=20 > > > "reasonable" number. > > > It knows that memory chips don't come in 1022Mb setups.. > > > So it`s quite easy to round number you get to closest power of 2.. > > >=20 > > > _____________________ > > > Timur Davidenko. > > > Crytek (http://www.crytek.com) > > >=20 > > > -----Original Message----- > > > From: Yannick Letourneau [mailto:yle...@ub...] > > > Sent: Monday, January 26, 2004 8:47 PM > > > To: gam...@li... > > > Subject: [GD-Windows] How to determine total physical=20 > > memory available=20 > > > ? > > >=20 > > > I need to determine how much memory is installed on the=20 > > user's system=20 > > > somehow. > > >=20 > > > I used GlobalMemoryStatus but the values returned in the member=20 > > > dwTotalPhys is always underestimating a bit. For example=20 > on my dev=20 > > > machine it returns > > > 1022 MB although I have 1024 MB installed. Same thing=20 > > happens on all=20 > > > systems I've tested. > > >=20 > > > Same thing is reported in dxdiag.exe so they seem to use=20 > > that function=20 > > > as well. > > >=20 > > > However, when I use the System Information tool in the=20 > > system tools of=20 > > > Windows, it correctly reports 1024 MB. > > >=20 > > > So anyone knows how I can get the exact information ? > > >=20 > > > Yannick L=E9tourneau > > > UBISOFT > > >=20 > > >=20 > > >=20 > > > ------------------------------------------------------- > > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference=20 > > > on Open Tools Development and Integration See the breadth=20 > > of Eclipse=20 > > > activity. February 3-5 in Anaheim, CA. > > > http://www.eclipsecon.org/osdn > > > _______________________________________________ > > > Gamedevlists-windows mailing list > > > Gam...@li... > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > Archives: > > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > > >=20 > > >=20 > > >=20 > > > ------------------------------------------------------- > > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference=20 > > > on Open Tools Development and Integration See the breadth=20 > > of Eclipse=20 > > > activity. February 3-5 in Anaheim, CA. > > > http://www.eclipsecon.org/osdn > > > _______________________________________________ > > > Gamedevlists-windows mailing list > > > Gam...@li... > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > Archives: > > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > > >=20 > > >=20 > > > ------------------------------------------------------- > > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference=20 > > > on Open Tools Development and Integration See the breadth=20 > > of Eclipse=20 > > > activity. February 3-5 in Anaheim, CA. > > > http://www.eclipsecon.org/osdn > > > _______________________________________________ > > > Gamedevlists-windows mailing list > > > Gam...@li... > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > Archives: > > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > > >=20 > > > --- > > > Incoming mail is certified Virus Free. > > > Checked by AVG anti-virus system (http://www.grisoft.com). > > > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > > > =20 > > >=20 > >=20 > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > > =20 > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference on Open Tools Development and Integration See the=20 > > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > > http://www.eclipsecon.org/osdn > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > >=20 > >=20 > > ------------------------------------------------------- > > The SF.Net email is sponsored by EclipseCon 2004 Premiere=20 > > Conference on Open Tools Development and Integration See the=20 > > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > > http://www.eclipsecon.org/osdn > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > >=20 > > --- > > Incoming mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > > =20 > >=20 >=20 > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > =20 >=20 >=20 >=20 > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 >=20 > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 > =20 >=20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.572 / Virus Database: 362 - Release Date: 27/01/2004 =20 |