On 12/02/2016 19:04, Aradeonas wrote:
Hi,
Im working on one of my projects and tried to make a release version, so I used shortcut button in build modes and add release mode but when I compile and run I get SIGSEGV error when main form want to be create. After many tries I found out that if I check "Use Heaptrc unit" in project debugging option program will run correctly even it is release mode so there is no debug info.
So simple :
If I check that option and use Heaptrc, no problem and if I unchecked it, error . Its a old project and I dont remind any code I write about heap so I cant find the problem so I want to ask anyone can guess what code can make such problem?


Common candidates are any code that
1) accesses memory behind or before allocatien
  dynArray[-10]  := x
  dynArray[length(dynArray)+10] := x

  foo := TObject.create;
  TChildClass(foo).something ....

  getmem, and then access outside the bounds
  pointer ....

2) any code accessing memory that was freed (any of the above)

-------
and worst of all, the error may or may not be triggered at the time of accessing the invalid mem. Sometimes it fails at some other completely valid code.

heaptrc changes memory layout as it stores the leaktrace info, and that means that by pure luck, the invalid memory access you do, does not affect the rest of your data. (or not anything that you detected yet)

A)
compile with heaptrc
and -Criot and any other flag you can find. Note the LCL does not work with -CR (upper R)

set the HEAPTRC environment to "keepreleased"

B)
If you can compile an Linux and run with valgrind.




--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to