Sign in Join

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

Mailing lists / fpc-devel / 2011-09

crash in heaptrc

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Martin

I get a crash in heaptrc.

It happens when the lazarus IDE is compiled with both -gh and -gc. It is triggered by an error in lazarus (most likely), but IMHO should probably not crash (so it could of course be corruption by Lazarus)

But first => Lazarus works fine with only -gh. As far as I know, if compiled with -gh, it uses no other mem manager but heaptrc. So I am pretty sure the result is NOT due to mixing mem managers.

It appears lazarus actually triggers the gc check. This happens, while accessing a pointer gotten from "LockResource" => maybe ultimately some memory provided by the OS (w32)

#0 UPDATECRC32(1760721319, 0, 4) at ..\inc\heaptrc.pp:202 #1 CALCULATE_SIG(0x4) at ..\inc\heaptrc.pp:222
#2 DUMP_ERROR(0x4, <error reading variable: Bad debug information detected: Attempt to read 592 bytes from registers.>) at ..\inc\heaptrc.pp:344
#3 CHECKPOINTER(0x68f279a7) at ..\inc\heaptrc.pp:1123 #4 LOADFROMRESOURCEHANDLE(0x163b80, 4194304, 19721916) at include\icon.inc:1391

So check pointer fails. => that may be ok => and I would expect an error to be raised (runerror 204) => but instead i get a SigSegV

Somehow "DumpError" crashes => and I am not sure, that this crash should happen.
Depends
- if lazarus indeed trashed structures belonging to heaptrc => well then it may happen
- if lazarus got memory from somewhere else (which could be the case here) then it shouldn't happen.

I haven't got the insight into heaptrc to quickly check what is the case.

Martin

Reply by email

Jonas Maebe
to Martin
Martin wrote
It happens when the lazarus IDE is compiled with both -gh and -gc

-gc is a fairly flaky option and it can only be used if your entire application only consists of FPC code.

In general, I would strongly recommend against ever using it, because you'll mist likely spend more time debugging issues caused by it than it will save you.

For debugging memory issues that aren't caught by heaptrc, use Valgrind (Unix) or Dr. Memory (Linux, Windows)

Jonas

Reply by email

Martin
to Jonas Maebe
Jonas Maebe wrote 7 lines
On 17 Sep 2011, at 16:41, Martin wrote: > It happens when the lazarus IDE is compiled with both -gh and -gc -gc is a fairly flaky option and it can only be used if your entire application only consists of FPC code. In general, I would strongly recommend against ever using it, because you'll mist likely spend more time debugging issues caused by it than it will save you.

ok, Anyway, I was just trying it, because it exists, not because I had a problem. So I will leave it.

thanks

Reply by email