[fpc-devel] Memory consumed by strings

Sergei Gorelkin sergei_gorelkin at mail.ru
Sun Nov 23 12:21:52 CET 2008


listmember wrote:

> This is my thick-day. So, permit me to ask this:
> 
> Are you really saying that strings occupy 50 MB Lazarus's memory footprint?
> 
> I just checked (using Process Explorer, under Windows) and this is what 
> I see:
> 
> Working set: 2,216 K
> Peak Working set: 26,988 K
> 
> I can't see where that 50 MB fits into that.

There's no easy way to tell how much storage the strings occupy. There 
are functions like GetHeapStatus and GetFPCHeapStatus, but they return 
the total amount of memory occupied by everything that the application 
allocates - objects, dyn.arrays, strings etc.
However, you may hack into RTL at the NewAnsiString / NewWideString / 
NewUnicodeString procedures and install hooks that will record the 
number of bytes requested. That shouldn't be too difficult to do.

Regards,
Sergei



More information about the fpc-devel mailing list