[Insight-developers] itksys:SystemInformation returns invalid memory information under windows
M.Staring at lumc.nl
M.Staring at lumc.nl
Wed Nov 18 04:17:59 EST 2009
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,
Marius
Marius Staring, PhD
Division of Image Processing (LKEB)
Department of Radiology
Leiden University Medical Center
PO Box 9600, 2300 RC Leiden, The Netherlands
phone: +31 (0)71 526 1106, fax: +31 (0)71 526 6801
m.staring at lumc.nl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091118/add4650d/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal_example.cxx
Type: application/octet-stream
Size: 728 bytes
Desc: minimal_example.cxx
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091118/add4650d/attachment.obj>
More information about the Insight-developers
mailing list