Skip to content

Heaptrc.TraceFreeMemSize segfaults

Original Reporter info from Mantis: MageSlayer @MageSlayer
  • Reporter name: Denis Golovan

Description:

Hi

Recently I update fpc to svn. 33055 (Linux 64bit build) and started receiving segfaults on application exit. Heaptrc.TraceFreeMemSize crashes at

...
    if pp^.todolist <> @loc_info^.heap_free_todo then
    begin
      { allocated in different heap, push to that todolist }
      pp^.todonext := pp^.todolist^;
      pp^.todolist^ := pp;  // <- CRASH HERE
      TraceFreeMemSize := pp^.size; 
      leavecriticalsection(todo_lock);
      exit;
    end;
...

After bisecting, it appeared that the first culprit is svn rev.33007.
Reverting this change and svn rev. 33008 fixes the issue.

Unfortunately I could not reproduce the issue in a small standalone project, but it seems it has something to do with multi-threaded memory allocations for dynamic arrays.

Mantis conversion info:

  • Mantis ID: 29612
  • Version: 3.1.1
  • Monitored by: » @onpok (Ondrej Pokorny)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information