Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-07

Heap usage

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

I'm not sure whether I should be asking here or on one of the FPC lists. Furthermore I'm sure I've seen this discussed previously but can't find it- my apologies.

Is there a simple function or variable which shows the amount of space currently allocated on the heap? I can't find the Lazarus/FPC equivalent of Delphi's AllocMemSize, and I'm looking for a simple metric I can place in a hint to warn of creeping leaks.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Micha Nelissen
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote
Is there a simple function or variable which shows the amount of space currently allocated on the heap? I can't find the Lazarus/FPC equivalent of Delphi's AllocMemSize, and I'm looking for a simple metric I can place in a hint to warn of creeping leaks.

Look for GetHeapStatus, it's even compatible with Delphi (if that's necessary).

Hint: compile application with -gh, that will use heap tracer and tell you at end of application where your leaked blocks are coming from.

Micha

Reply by email

Mark Morgan Lloyd
to Micha Nelissen
Micha Nelissen wrote
Look for GetHeapStatus, it's even compatible with Delphi (if that's necessary).

Thanks, just the job. It's a hack when I'm leaving a serial comms program looping so I can see what happens when things have settled down, no plans to port to Delphi although I might make sure the library works with Windows.

Hint: compile application with -gh, that will use heap tracer and tell you at end of application where your leaked blocks are coming from.

Thanks for that as well :-)

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email