[fpc-devel] Memory consumed by strings

Marco van de Voort marcov at stack.nl
Sun Nov 23 14:10:34 CET 2008


In our previous episode, listmember said:
> Is there a way to determine how much memory is consumed by strings by a 
> running application?

Maybe you can keep a counter in the routines of astrings.  Increase/adjust on
newansistring or setlength.
 
> I'd like to know this, in particular, for FPC ana Lazarus --to begin with.
> 
> And, the reason I'd like to know this is this: Whenever I suggest that 
> char size be increased to 4, the idea gets opposed on the grouds that it 
> will need huge memory --4 times as much.

That's not the only reason:
- more memory also means slower copy.
- Most OSes seem to use uTF-8 and UTF-16, with -32 you would an island, and
the avg text editors might not be able to read what you write
 
> There's of course some merit in that arguement, but I have no idea what 
> it is '4 times' of.

> This is not very engineer-like --it being unmeasured.

It is highly dependant on use. An attempt on a single application says
nothing.

The app that I work on for a living has maybe 0.5MB of strings, and hardly
any time consuming processing. (mostly a simple logfile).

In previous jobs however I have done database-in-memory, database pumps and
importers, and there it matters.
 
> Can anyone suggest a way to measure the memory load caused by strings?




More information about the fpc-devel mailing list