error with nExtMem()

User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

error with nExtMem()

Post 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!!.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: error with nExtMem()

Post by ukservice »

Hello,

Is there any update?.

Thanks
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: error with nExtMem()

Post by Antonio Linares »

John,

Please run this and let us know what you get, thanks:

MsgInfo( Int( nExtMem() / ( 1024 * 1024 * 1024 ) ) + 1 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: error with nExtMem()

Post by ukservice »

Antonio,

I just get 1.

Thanks.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: error with nExtMem()

Post by Antonio Linares »

Here we get 2 which it is right,

Could someone else test it and report the result here ? thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Baxajaun
Posts: 853
Joined: Wed Oct 19, 2005 2:17 pm
Location: Gatika. Bizkaia

Re: error with nExtMem()

Post by Baxajaun »

I get 1, wich is wrong.

Felix
User avatar
Baxajaun
Posts: 853
Joined: Wed Oct 19, 2005 2:17 pm
Location: Gatika. Bizkaia

Re: error with nExtMem()

Post by Baxajaun »

Enrico,

yes and Harbour 3.

Felix
User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: error with nExtMem()

Post by ukservice »

I have 8 GB of RAM, so I can´t get 1!!
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: error with nExtMem()

Post 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 ? :-(
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
IBTC
Posts: 103
Joined: Sat Oct 18, 2008 8:13 pm
Location: Stuttgart, Germany
Contact:

Re: error with nExtMem()

Post 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.
Best Regards,
Ruediger Alich

---
HMG 3.1.3 | FTDN/FWH 13.12 | Harbour 3.2 | BCC/MinGW | Windows XP/Vista/7/8/10 (32/64-Bit), Wine (Linux/Mac) - started 1999 with FW, 1989 with Clipper
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: error with nExtMem()

Post 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 );
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
ukservice
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: error with nExtMem()

Post by ukservice »

The correct is:

Code: Select all

hb_retnll( mst.ullTotalPhys );

I got 8.

So I hope MsgInfo( Int( nExtMem() / ( 1024 * 1024 * 1024 ) ) + 1 ) refers to 8 GB.

Is it correct?.

Thanks,.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: error with nExtMem()

Post by Antonio Linares »

Yes, it seems so :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply