[Insight-developers] FW: [Fwd: itksys:SystemInformation returns invalid memory information under windows]

M.Staring at lumc.nl M.Staring at lumc.nl
Wed Nov 18 11:44:21 EST 2009


Hi David,
 
Thanks for addressing this issue so quickly. I can confirm that the fix
works for me.
 
Thanks again,
 
Marius


________________________________

	From: David Cole [mailto:david.cole at kitware.com] 
	Sent: woensdag 18 november 2009 17:29
	To: Staring, M. (LKEB); Bill Hoffman
	Subject: Re: [Fwd: [Insight-developers] itksys:SystemInformation
returns invalid memory information under windows]
	
	
	Marius,

	Thanks for bringing this to our attention. Please forward this
reply to the list...

	We weren't setting the dwLength member of the struct prior to
calling those functions like we're supposed to. I just committed a fix. 


	Thanks,
	David Cole
	Kitware, Inc.


	On Wed, Nov 18, 2009 at 9:51 AM, Bill Hoffman
<bill.hoffman at kitware.com> wrote:
	

		Any ideas?
		
		
		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
		
		
		_______________________________________________
		Powered by www.kitware.com
		
		Visit other Kitware open-source projects at
		http://www.kitware.com/opensource/opensource.html
		
		Kitware offers ITK Training Courses, for more
information visit:
		http://kitware.com/products/protraining.html
		
		Please keep messages on-topic and check the ITK FAQ at:
		http://www.itk.org/Wiki/ITK_FAQ
		
		Follow this link to subscribe/unsubscribe:
		http://www.itk.org/mailman/listinfo/insight-developers
		
		


	No virus found in this incoming message.
	Checked by AVG - www.avg.com
	Version: 9.0.707 / Virus Database: 270.14.71/2510 - Release
Date: 11/18/09 08:50:00
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091118/9a714780/attachment.htm>


More information about the Insight-developers mailing list