Possible to "Redim" Dictionary?
I wonder if it's possible to "redim" the dictionary if I need more keys.
The help warns about:
Quote:
More than NumberOfKeys keys can be stored into a dictionary but this will slow down all operations.
So I fear to reach the limit but also to use up unnecessary memory if not 5000 keys used...
Now I thought about some "Redim Preserve" in this manner:
Code:
Uses "Dictionary"
Dword pDictionary = Dictionary_Create(1000)
' ...
' now discover I have reached limit, 1000 Keys are used...
' copy dictionary to some buffer
Dword pBuffer = Heap_Alloc( Dictionary_MemInfo(pDictionary, %HT_MemInfo_Total) )
Memory_Copy( pDictionary, pBuffer, Heap_Size(pBuffer) )
'kill the old dictionary
Dictionary_Free(pDictionary)
' create a bigger one
pDicitonary = Dictionary_Create(2000)
' put the data back?
Memory_Copy( pBuffer, pDictionary, Heap_Size(pBuffer) )
would this work or corrupt the dictionary-content?