FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Memory() under Fivewin
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Memory() under Fivewin
Posted: Mon Mar 27, 2023 03:10 AM
hi,

how to get "Total Memory" and "Available Memory" under Fivewin :?:

have try Memory(1) up to Memory(4) but Value seem not to "match"
have found MemStat() but it show Array in Msgbox() ... how get 3rd Element of Array :?:
greeting,

Jimmy
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Memory() under Fivewin
Posted: Mon Mar 27, 2023 06:40 AM
Dear Jimmy,

function Memory() belongs to Harbour which does a wrapper to Harbour's hb_xquery() function:
https://github.com/harbour/core/blob/master/src/vm/fm.c

Basically is uses the Windows API functions to query those values
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Memory() under Fivewin
Posted: Mon Mar 27, 2023 09:24 AM
hi Antonio,

i have now try MEMORY() with all "hbmemory.ch" Constant
but still "Total Memory" (2,914 GB get by WMI) of 32 Bit OS is not shown

Code (fw): Select all Collapse
/* Parameters for Memory() function */

/* Standard */
#define HB_MEM_CHAR             0   /* Free Variable Space (KB) */
#define HB_MEM_BLOCK            1   /* Largest String (KB) */
#define HB_MEM_RUN              2   /* RUN Memory (KB) */

/* CA-Cl*pper undocumented */
#define HB_MEM_VM               3   /* Virtual Memory (KB) */
#define HB_MEM_EMS              4   /* Free Expanded Memory (KB) (?) */
#define HB_MEM_FM             101   /* Fixed Memory/Heap (KB) (?) */
#define HB_MEM_FMSEGS         102   /* Segments in Fixed Memory/Heap (?) */
#define HB_MEM_SWAP           103   /* Free Swap Memory (KB) */
#define HB_MEM_CONV           104   /* Free Conventional (KB) */
#define HB_MEM_EMSUSED        105   /* Used Expanded Memory (KB) (?) */

/* Harbour extensions */
#define HB_MEM_USED          1001   /* Memory used (bytes) */
#define HB_MEM_USEDMAX       1002   /* Maximum memory used (bytes) */
#define HB_MEM_STACKITEMS    1003   /* Total items on the stack */
#define HB_MEM_STACK         1004   /* Total memory size used by the stack (bytes) */
#define HB_MEM_STACK_TOP     1005   /* Total items currently on the stack */
#define HB_MEM_BLOCKS        1007   /* Total number of memory blocks allocated */
#define HB_MEM_STATISTICS    1008   /* Return non 0 value if FM statistic is enabled */
#define HB_MEM_CANLIMIT      1009   /* Return non 0 value if used memory limit is supported */
greeting,

Jimmy
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Memory() under Fivewin
Posted: Mon Mar 27, 2023 11:02 AM
hi,

found solution in c:\fwh\source\function\errsysw_.prg
Code (fw): Select all Collapse
cErrorLog += "   Hardware memory: " + ;
                    cValToChar( Int( nExtMem() / ( 1024 * 1024 ) ) + 1 ) + " MB ( available: "+;
                    cValToChar (Int (nAvailMem() / (1024 * 1024 ) ) +1 ) + " MB )" + CRLF + CRLF
greeting,

Jimmy
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Memory() under Fivewin
Posted: Mon Mar 27, 2023 11:07 AM
very good :-)

Ye, FWH uses its own memory functions
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion