WYRDTEK Home Features Reference Downloads About


Reference/es_sd_new

Syntax

struct es_sd *es_sd_new( unsigned chunksize, int storestrings );

Arguments

unsigned chunksize Memory allocation "chunk" size.
int storestrings Flag to indicate whether to store id-to-sting mappings. Non-zero means yes (ES_SD_STORESTRINGS). Zero means no (ES_SD_NOSTORESTRINGS).

Description

Construct and return a new string dictionary.

chunksize is a suggested memory allocation "chunk" size, or rather the minimum amount of memory to allocate off the heap at any one time. Chunk sizes of around 8K (8192 bytes) are suitable for medium to large string dictionaries (upwards of around 100,000 strings).

storestrings is flag that controls whether an integer-id to string mapping should stored in addition to a string to integer-id mapping. Non-zero means yes. Zero means no. If set to zero, es_sd_getstr() will always return the empty string "".

A string dictionary may be subsequently destroyed via es_sd_delete().

String dictionaries can be stored in databases via user-defined fields (see es_mbc_addfldmbu() ).

[Back To Reference] [Back To Reference/es_sd]