11-06-2012, 03:02 PM
compiuter Wrote:I don“t know about the default strings, but old compilers had options to select string length, my question is about effect of retail length of strings. Example: DefaultShort=8 chars DefaultLong=32 chars.
What do you think of this?
String length here are dynamic. They only take 2 + LEN(string) bytes in memory. When a string grows (e.g. A$ = A$ + " "), the block is resized and/or reallocated. Then the string shortens (e.g. A$ = A$(2 TO) or the like). Nothing is done... unless the length decreased 4 or more bytes. In such case, the block is resized and/or reallocated and the memory freed.
Upon each block realloacation, the heap is defragmented.