Page 1 of 2
error with nExtMem()
Posted: Thu Sep 01, 2011 4:57 pm
by ukservice
Hello.
In errsysw.prg, nExtMem() does not indicate my 6 GB of Ram.
It only says 1 megs:
Hardware memory: 1 megs
Also, it may cause internal problems to FWH, as it points out no memory, when in fact it is plenty of gbs!!.
Re: error with nExtMem()
Posted: Wed Sep 21, 2011 6:05 pm
by ukservice
Hello,
Is there any update?.
Thanks
Re: error with nExtMem()
Posted: Wed Sep 21, 2011 6:17 pm
by Antonio Linares
John,
Please run this and let us know what you get, thanks:
MsgInfo( Int( nExtMem() / ( 1024 * 1024 * 1024 ) ) + 1 )
Re: error with nExtMem()
Posted: Wed Sep 21, 2011 6:32 pm
by ukservice
Antonio,
I just get 1.
Thanks.
Re: error with nExtMem()
Posted: Wed Sep 21, 2011 10:32 pm
by Antonio Linares
Here we get 2 which it is right,
Could someone else test it and report the result here ? thanks
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 8:34 am
by Enrico Maria Giordano
I get 2, which is right too.
EMG
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 8:54 am
by Baxajaun
I get 1, wich is wrong.
Felix
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 9:46 am
by Enrico Maria Giordano
Are you using latest FWH?
EMG
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 10:08 am
by Baxajaun
Enrico,
yes and Harbour 3.
Felix
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 10:11 am
by ukservice
I have 8 GB of RAM, so I can´t get 1!!
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 10:12 am
by Antonio Linares
FWH function nExtMem() is a simple wrapper to the Windows API function GlobalMemoryStatus() :
http://msdn.microsoft.com/en-us/library ... S.85).aspx
that fills a struct:
http://msdn.microsoft.com/en-us/library ... S.85).aspx
In that struct we check the value of dwTotalPhys that as the API explains:
The amount of actual physical memory, in bytes.
FWH code:
Code: Select all
HB_FUNC( NEXTMEM ) // --> nHardwareMemory
{
MEMORYSTATUS mst;
mst.dwLength = sizeof( MEMORYSTATUS );
GlobalMemoryStatus( &mst );
hb_retnl( mst.dwTotalPhys );
}
Our code does nothing except the call to Windows API, so the question is; is that WIndows API function failing ?
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 10:20 am
by IBTC
Hi Antonio,
Antonio Linares wrote:FWH function nExtMem() is a simple wrapper to the Windows API function GlobalMemoryStatus() :
Our code does nothing except to call to Windows API, so the question is; is that WIndows API function failing ?
Have a look here:
http://msdn.microsoft.com/en-us/library/aa366586.aspx:
On computers with more than 4 GB of memory, the GlobalMemoryStatus function can return incorrect information, reporting a value of –1 to indicate an overflow. For this reason, applications should use the GlobalMemoryStatusEx function instead.
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 10:30 am
by Antonio Linares
Ruediger,
Thanks for the info, I wasn't aware of this API function. So this is the new code to test:
Code: Select all
HB_FUNC( NEXTMEM ) // --> nHardwareMemory
{
MEMORYSTATUSEX mst;
mst.dwLength = sizeof( MEMORYSTATUSEX );
GlobalMemoryStatusEx( &mst );
hb_retnl( mst.ullAvailPhys );
}
we could also try:
hb_retnll( mst.ullAvailPhys );
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 10:55 am
by ukservice
The correct is:
I got 8.
So I hope MsgInfo( Int( nExtMem() / ( 1024 * 1024 * 1024 ) ) + 1 ) refers to 8 GB.
Is it correct?.
Thanks,.
Re: error with nExtMem()
Posted: Thu Sep 22, 2011 11:14 am
by Antonio Linares
Yes, it seems so