Skip to content

Commit

Permalink
Merge pull request pleriche#26 from gabr42/contentionlogger_bugfix_20…
Browse files Browse the repository at this point in the history
…161110

Two fixes for lock contention logger:
MediumBlockCollector was used for all logging in FastGetMem regardless of which allocator was used to produce the code.
There was a code path through FastGetMem where lock contention wasn't logged at all
  • Loading branch information
pleriche authored Nov 14, 2016
2 parents d3ea5e3 + e17ab31 commit 16ecccd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion FastMM4.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5038,6 +5038,15 @@ function FastGetMem(ASize: {$ifdef XE2AndUp}NativeInt{$else}{$ifdef fpc}NativeUI
{$endif}
{Done}
MediumBlocksLocked := False;
{$ifdef LogLockContention}
{$ifndef FullDebugMode}
if Assigned(ACollector) then
begin
GetStackTrace(@LStackTrace, StackTraceDepth, 1);
ACollector.Add(@LStackTrace[0], StackTraceDepth);
end;
{$endif}
{$endif}
Exit;
{$ifndef FullDebugMode}
end;
Expand Down Expand Up @@ -5136,7 +5145,7 @@ function FastGetMem(ASize: {$ifdef XE2AndUp}NativeInt{$else}{$ifdef fpc}NativeUI
if Assigned(ACollector) then
begin
GetStackTrace(@LStackTrace, StackTraceDepth, 1);
MediumBlockCollector.Add(@LStackTrace[0], StackTraceDepth);
ACollector.Add(@LStackTrace[0], StackTraceDepth);
end;
{$endif}
{$endif}
Expand Down

0 comments on commit 16ecccd

Please sign in to comment.