xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HAllocate()

Pre-allocates memory for a large hash.

Syntax

HAllocate( <hHash>, <nCount> ) --> NIL

Arguments

<hHash>
A variable referencing an empty hash to pre-allocate memory for.
<nCount>
A numeric value specifying the number of key/value pairs to reserve memory for.

Return

The function returns always NIL.

Description

The function is used to pre-allocate memory for an empty hash or to reduce its pre-allocated size. When the number of key/value pairs to collect in a hash is approximately known in advance, it can be useful to pre-allocate memory for it so that the time to grow a hash and allocate memory for it is reduced to a minimum. To reduce memory pre-allocated in excess, call HAllocate() with a small value for <nCount>.

The function is provided in case huge hashes must be built and performance is at stake. Normally, the partitioning of hashes using HSetPartition() is more effective in creating large hashes.

Info

See also:Hash(), HSetPartition()
Category: Hash functions , xHarbour extensions
Source:vm\hash.c
LIB:xhb.lib
DLL:xhbdll.dll


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