error with nExtMem()

error with nExtMem()

Postby ukservice » Thu Sep 01, 2011 4:57 pm

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()

Postby ukservice » Wed Sep 21, 2011 6:05 pm

Hello,

Is there any update?.

Thanks
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()

Postby Antonio Linares » Wed Sep 21, 2011 6:17 pm

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
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error with nExtMem()

Postby ukservice » Wed Sep 21, 2011 6:32 pm

Antonio,

I just get 1.

Thanks.
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()

Postby Antonio Linares » Wed Sep 21, 2011 10:32 pm

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
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error with nExtMem()

Postby Enrico Maria Giordano » Thu Sep 22, 2011 8:34 am

I get 2, which is right too.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: error with nExtMem()

Postby Baxajaun » Thu Sep 22, 2011 8:54 am

I get 1, wich is wrong.

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

Re: error with nExtMem()

Postby Enrico Maria Giordano » Thu Sep 22, 2011 9:46 am

Are you using latest FWH?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: error with nExtMem()

Postby Baxajaun » Thu Sep 22, 2011 10:08 am

Enrico,

yes and Harbour 3.

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

Re: error with nExtMem()

Postby ukservice » Thu Sep 22, 2011 10:11 am

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
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: error with nExtMem()

Postby Antonio Linares » Thu Sep 22, 2011 10:12 am

FWH function nExtMem() is a simple wrapper to the Windows API function GlobalMemoryStatus() :

http://msdn.microsoft.com/en-us/library/aa366586(v=VS.85).aspx

that fills a struct:

http://msdn.microsoft.com/en-us/library/aa366772(v=VS.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  Expand view
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
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error with nExtMem()

Postby IBTC » Thu Sep 22, 2011 10:20 am

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
IBTC
 
Posts: 103
Joined: Sat Oct 18, 2008 8:13 pm
Location: Stuttgart, Germany

Re: error with nExtMem()

Postby Antonio Linares » Thu Sep 22, 2011 10:30 am

Ruediger,

Thanks for the info, I wasn't aware of this API function. So this is the new code to test:

Code: Select all  Expand view
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
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error with nExtMem()

Postby ukservice » Thu Sep 22, 2011 10:55 am

The correct is:

Code: Select all  Expand view
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
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: error with nExtMem()

Postby Antonio Linares » Thu Sep 22, 2011 11:14 am

Yes, it seems so :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 87 guests