[Lazarus] read text file in lazarus

Graeme Geldenhuys graemeg.lists at gmail.com
Sat Apr 4 23:12:43 CEST 2009

On Sat, Apr 4, 2009 at 6:13 PM, waldo kitty <wkitty42 at windstream.net> wrote:
> my thoughts exactly... and folk wonder why today's programs are so bloated,
> slow, memory hogs and require a mini-cray just to operate with some decency of
> speed ;)

Very true!  Just curious, how do you know how much memory an
application uses? Preferably a Linux and Windows method.

Does the 'heaptrc' unit do that?

eg:  TStringList vs Old Fashioned TextFile
Both CLI test programs loaded the same sample text file and simply
does a writeln() for each line of the sample text file and then quits.
The sample text file is 26.4KB in size.

Old Fashioned TextFile
$> ./project1
Heap dump by heaptrc unit
522 memory blocks allocated : 163178/164720
522 memory blocks freed     : 163178/164720
0 unfreed memory blocks : 0
True heap size : 131072
True free heap : 131072

$> ./project2
Heap dump by heaptrc unit
457 memory blocks allocated : 106081/107664
457 memory blocks freed     : 106081/107664
0 unfreed memory blocks : 0
True heap size : 360448
True free heap : 360448

As you can see, one allocates more memory blocks, but the other uses
less heap size. So which method is better?

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the Lazarus mailing list