Re: Compiler String Efficiency

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On 15 Sep 2005 19:03:01 -0700, "dw85745@xxxxxxxxxxxxx"
<dw85745@xxxxxxxxxxxxx> wrote:

>Thanks for responding Mr. Wood.

>My thoughts -- as you expressed -- were 1 and 2 were equal, but that
>the stack would allocate memory = VB default (as I recall 255
>characters) and then store the 10 character string in the allotted
>memory, padding the rest with spaces. The variable (pointer to the
>string) would then just reference the first 10 bytes of this 255
>character memory block.

You can forget that 255 character stuff
- also String /Data/ is not on the Stack
- the pointer to the String Data might or might not be on the stack
depending on where and how the String is Dim-ed

>WhereAs 3

>while initially allocating the VB Default, the memory allocation would
>then be revised down to 10 characters, freeing up the balance of the
>allotted string memory for other use.

>Does this seem reasonable?

It is not how it works

Try the following :
Me.Print VarPtr( S )
Me.Print StrPtr( S )

>BTW have looked for but haven't found a discussion on this -- hence the
>post.

You seem to have picked up some information on how Delphi handles
Strings - VB does not work like that at all
.



Relevant Pages

  • Re: This is getting really weird.
    ... I thought 4 bytes for reference count and 4 for string length. ... > There should be no memory allocation for that line. ... > manager may allocate more space than requested for its own efficiency. ... > that New returned with a pointer to the string constant. ...
    (alt.comp.lang.borland-delphi)
  • [TOMOYO #15 3/8] Common functions for TOMOYO Linux.
    ... This file contains common functions (e.g. policy I/O, pattern matching). ... Since TOMOYO Linux is a name based access control, ... TOMOYO Linux's string manipulation functions make reviewers feel crazy, ... the Linux kernel accepts all characters but NUL character ...
    (Linux-Kernel)
  • Re: The type of argv in K&R2
    ... has type pointer to character strings. ... members of that array each point to the first character of a string that ... The next member, the member, ...
    (comp.lang.c)
  • Re: Outdated help (feat. Access 97 and VB4)
    ... At y we find the block of memory which holds the string this is then ... terminated by a null character ... We can modify some code I posted earlier to get what is in memory from y-4 ... There are several important things to note about the BSTR data type. ...
    (comp.databases.ms-access)
  • Re: [C++] Help!: map<userdefined*, vector<int>>
    ... >> The map will be sorted along pointer values. ... a constant string and as such has an address in memory. ... The only way to do that, if you used the very same memory ... >> and see if the sorted map output reflects that change. ...
    (alt.comp.lang.learn.c-cpp)