xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Memory()

Returns memory statistics.

Syntax

Memory( <nWhichMemory> ) --> nMemoryUsage

Arguments

<nWhichMemory>
A numeric value must be passed to identify the memory to query. The following table lists #define constants listed in HBMemory.ch that can be used for <nWichMemory>.

Constants for memory statistics
ConstantValueDescription
HB_MEM_CHAR0Free Variable Space (KB)
HB_MEM_BLOCK1Largest String (KB)
HB_MEM_RUN2RUN Memory (KB)
HB_MEM_VM3Virtual Memory (KB)
HB_MEM_FM101Fixed Memory/Heap (KB)
HB_MEM_FMSEGS102Segments in Fixed Memory/Heap
HB_MEM_SWAP103Free Swap Memory (KB)
HB_MEM_CONV104Free Conventional (KB)
HB_MEM_EMSUSED105Used Expanded Memory (KB)
HB_MEM_USED1001Memory used (bytes)
HB_MEM_USEDMAX1002Maximum memory used (bytes)
HB_MEM_STACKITEMS1003Total items on the stack
HB_MEM_STACK1004Total memory size used by the stack (bytes)
HB_MEM_STACK_TOP1005Total items currently on the stack
HB_MEM_LIST_BLOCKS1006List all allocated blocks

Return

The function returns a numeric value indicating usage of the specified memory.

Description

The function is used to obtain values for current memory usage. The type of memory to use must be specified with #define constants. Not all memory types are supported on all platforms. If a memory type cannot be queried, the return value is zero.

Memory() can give only a "snapshot" of current memory usage while the function is being executed. The memory usage may have changed when the function returns due to the activity of xHarbour's garbage collector.

Info

See also:GetEnv(), HB_GCAll()
Category: Debug functions , Environment functions , xHarbour extensions
Header:hbmemory.ch
Source:vm\fm.c
LIB:xhb.lib
DLL:xhbdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe