[prev] [prev-tail] [tail] [up]

#### 3.2.11 String sizes

The memory occupied by a string depends on the string type. Some string types allocate the string data in memory on the heap, others have the string data on the stack. Table table (3.6) summarizes the memory usage of the various string types for the various string types. In the table, Headersize depends on the version of Free Pascal, but is 16 bytes as of Free Pascal 2.7.1. L is the actual length of the string.

Table 3.6: String memory sizes

String type | Stack size | heap size

Shortstring | Declared length + 2 | 0
Ansistring | Pointer size | L + 1 + HeaderSize
Widestring | Pointer size | 2*L + 1 + HeaderSize (0 on Windows)
UnicodeString | Pointer size | 2*L + 1 + HeaderSize
Pchar | Pointer size | L+1

[prev] [prev-tail] [front] [up]