[Insight-developers] itksys:SystemInformation returns invalid memory information under windows
M.Staring at lumc.nl
M.Staring at lumc.nl
Wed Nov 18 09:59:34 EST 2009
> -----Original Message-----
> From: Bill Hoffman [mailto:bill.hoffman at kitware.com]
> Sent: woensdag 18 november 2009 15:53
> To: Staring, M. (LKEB)
> Cc: insight-developers at itk.org
> Subject: Re: [Insight-developers] itksys:SystemInformation
> returns invalid memory information under windows
>
> M.Staring at lumc.nl wrote:
> > Hi all,
> >
> > I am using
> >
> > itksys::SystemInformation info;
> > info.RunMemoryCheck();
> >
> > to obtain information about the total physical memory that
> is available
> > on a windows system.
> >
> > However, the function returns incorrect results. When
> digging into the
> > code I saw that itksys internally uses the windows function
> > GlobalMemoryStatusEx for my particular system (windows XP,
> 64 bit, 4 GB
> > of memory, Visual Studio 2008). As an alternative I used
> > GlobalMemoryStatus instead of GlobalMemoryStatusEx, which
> does seem to
> > work. These are the results I get in MB:
> >
> > Debug mode:
> > TotalPhysicalMemory ITK:3276
> > GlobalMemoryStatusEx:3276
> > GlobalMemoryStatus:4079
> >
> > Release mode:
> > TotalPhysicalMemory ITK:1024
> > GlobalMemoryStatusEx:0
> > GlobalMemoryStatus:4079
> >
> > Where the first line is the itksys implementation, the
> second a direct
> > windows call to GlobalMemoryStatusEx and the last a direct call to
> > GlobalMemoryStatus. Note the different results in debug and
> release mode
> > for itksys and GlobalMemoryStatusEx. GlobalMemoryStatus
> does give me the
> > correct results. I have attached the code to reproduce
> these figures.
> >
> > Is there a reason why GlobalMemoryStatusEx is used for
> MSC_VER > 1300,
> > see line 2273 and following of
> Utilities/kwsys/SystemInformation.cxx ?
> > Is this a bug?
> >
> > Thanks for your advice, regards,
> >
>
> The MSDN docs seems to say the opposite of what you are seeing...
>
> http://msdn.microsoft.com/en-us/library/aa366586%28VS.85%29.aspx
>
Indeed, they recommend GlobalMemoryStatusEx.
> What compiler are you using?
>
> -Bill
Microsoft Visual Studio C++ 2008 (Team edition)
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1
Someone with visual studio 2008 express also reported the problem.
Did you try my minimal example on your system?
Marius
More information about the Insight-developers
mailing list