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.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL