[fpc-devel] Re: dominant short strings in compiler source

Daniël Mantione daniel.mantione at freepascal.org
Fri May 19 18:52:36 CEST 2006



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


More information about the fpc-devel mailing list