Sign in Join

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

Mailing lists / fpc-pascal / 2010-10

negative numbers in CurrHeapUsed and MaxHeapUsed

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Bernd Kreuss

Does anybody know what has become of this:
http://free-pascal-general.1045716.n5.nabble.com/TFPCHeapStatus-miscalculations-in-2-3-1-td2824362.html

I am currently experiencing the same problem. The only thing my Program does on the heap are ansistring manipulations, concatenating strings to new strings and discarding intermediate results. The total amount used by my strings should not grow they should be all discarded after processing, they are all only temporarily used in local variables inside procedures.

CurrHeapUsed starts around 4000 and then after a few hours slowly shrinks(!) until it eventually becomes negative (not always, there is some randomness in my data and the amount of strings that are processed, sometimes I have to wait longer). MaxHeapUsed starts with 16576 and then suddenly drops to -16.

This all happens with FPC 2.5.1, snapshot from a few days ago.

Is this a known problem and nothing to worry about or am I asking for trouble if I ignore this?

Bernd

Bernd Kreuss
to Jonas Maebe
Jonas Maebe wrote
It's only a cosmetic problem, there is no problem with the heap itself. It's a known bug, related to reallocmem: http://bugs.freepascal.org/view.php?id=15805

If I understand this correctly then these are only meaningless counters that come out of sync. Is there a way to ask the heap manager directly for the "real" numbers? The heap manager must somehow be able to know this or calculate this, it cannot rely on these broken counters or it would eventually crash or otherwise misbehave, wouldn't it?

Bernd

Marco van de Voort
to Bernd Kreuss

In our previous episode, Bernd Kreuss said:

Show quoted text 7 lines
> It's only a cosmetic problem, there is no problem with the heap itself. It's a known bug, related to reallocmem: http://bugs.freepascal.org/view.php?id=15805 If I understand this correctly then these are only meaningless counters that come out of sync. Is there a way to ask the heap manager directly for the "real" numbers? The heap manager must somehow be able to know this or calculate this, it cannot rely on these broken counters or it would eventually crash or otherwise misbehave, wouldn't it?

No. The heap structures for operation are intact, but the routines to calculate the counters not.

The counters are for human presentation only, and have no other function.

Jonas Maebe
to Bernd Kreuss: If I understand this correctly then these are only meaningless counters that come out of…
Bernd Kreuss wrote 6 lines
On 22.10.2010 21:23, Jonas Maebe wrote: > It's only a cosmetic problem, there is no problem with the heap itself. It's a known bug, related to reallocmem: http://bugs.freepascal.org/view.php?id=15805 If I understand this correctly then these are only meaningless counters that come out of sync.

Yes.

Is there a way to ask the heap manager directly for the "real" numbers? The heap manager must somehow be able to know this or calculate this, it cannot rely on these broken counters or it would eventually crash or otherwise misbehave, wouldn't it?

The heap manager does not depend on any counters, so there are no real numbers to request. Those (meaningless) counters are the only ones that exist.

Jonas