Allocating memory in VB (Custom strings)
I have been working on a couple of classes which are custom strings. Thereasons
why I want to do this are:
* The strings use ASCII internally, so no conversion is required when dealing
with pure ASCII data (such as on the web).
* I can write string processing routines which manipulate string data with
the minimum of allocation/deallocation.
* I can have a "string pointers" class based on my custom string class, thus
meaning that I don't always have to copy string data.
Currently I am using Byte arrays to allocate memory for my arrays. I am
also leveraging the Shlwapi.dll string functions so as to provide replacements
for InStr. But I have just come to my Replace method, and have just wondered
whether the ReDim Preserve calls that I must use to increase the string size
are the most efficient way to allocate new memory. Having read the chapter
on strings in Matt Curland's "Advanced Visual Basic 6", I am wondering whether
it would be better to use BSTRs instead, purely to allocate memory (he says
that 64k of BSTRs are cached). Otherwise, should I use system functions
to allocate memory directly?
Mark Alexander Bertenshaw
Chordiant Software, Inc.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center