[fpc-devel] Re: dominant short strings in compiler source
Flávio Etrusco
flavio.etrusco at gmail.com
Fri May 19 19:00:42 CEST 2006
On 5/19/06, Daniël Mantione <daniel.mantione at freepascal.org> wrote:
>
>
> Op Fri, 19 May 2006, schreef Micha Nelissen:
>
> > On Fri, 19 May 2006 18:29:29 +0100
> > Peter Vreman <peter at freepascal.org> wrote:
> >
> > > There are already some complains about the memory usage. Increasing the
> > > string size adds a lot more overhead. Especially for all the small labels
> > > like .L1 etc. Already using longstrings will add 3 bytes for the length
> > > alsomost doubling the size from 4 to 7 bytes.
> >
> > Don't shortstrings always use 256 bytes of memory ?
>
> It depends on wether they are stored in a variable of type "string", or
> allocated on the heap with a "Pstring". In all data structures where
> memory usage is an issue, the memory friendly Pstring is used.
>
> Still, because the compiler uses a lot of short strings, the internal heap
> data structures are an important factor in the memory usage of these
> strings.
>
> Daniël
>
Forgive me if I'm saying BS but it's been about 10 years since I
programmed in TurboPascal (and used ShortStrings), but don't
ShortStrings use the size they are declared with? And 255 is just
default size (if no size is specified)?
-Flávio
More information about the fpc-devel
mailing list