View Issue Details

IDProjectCategoryView StatusLast Update
0038316FPCCompilerpublic2021-01-10 16:48
ReporterC Western Assigned ToJonas Maebe  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformAAarch64OSDarwin 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0038316: Bad code generation leading to memory leak
DescriptionThe attached code leaks memory on aaarch64 - a temporary array copy is not freed
Steps To Reproduce./project1
Heap dump by heaptrc unit of "memerr/./project1"
11 memory blocks allocated : 132/176
0 memory blocks freed : 0/0
11 unfreed memory blocks : 132
True heap size : 327680 (32 used in System startup)
True free heap : 325184
Should be : 325360
Call trace for block $00000001004B09C0 size 12
  $00000001003A493C
Call trace for block $00000001004B08E0 size 12
  $00000001003A493C
Call trace for block $00000001004B0800 size 12
  $00000001003A493C
Call trace for block $00000001004B0720 size 12
  $00000001003A493C
TagsNo tags attached.
Fixed in Revision48130
FPCOldBugId
FPCTarget-
Attached Files

Activities

C Western

2021-01-05 19:40

reporter  

project1.lpi (1,633 bytes)   
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
  <ProjectOptions>
    <Version Value="12"/>
    <General>
      <Flags>
        <MainUnitHasCreateFormStatements Value="False"/>
        <MainUnitHasTitleStatement Value="False"/>
        <MainUnitHasScaledStatement Value="False"/>
      </Flags>
      <SessionStorage Value="InProjectDir"/>
      <Title Value="project1"/>
      <UseAppBundle Value="False"/>
      <ResourceType Value="res"/>
    </General>
    <BuildModes>
      <Item Name="Default" Default="True"/>
    </BuildModes>
    <PublishOptions>
      <Version Value="2"/>
      <CompressFinally Value="False"/>
      <UseFileFilters Value="True"/>
    </PublishOptions>
    <RunParams>
      <FormatVersion Value="2"/>
    </RunParams>
    <Units>
      <Unit>
        <Filename Value="project1.lpr"/>
        <IsPartOfProject Value="True"/>
      </Unit>
    </Units>
  </ProjectOptions>
  <CompilerOptions>
    <Version Value="11"/>
    <Target>
      <Filename Value="project1"/>
    </Target>
    <SearchPaths>
      <IncludeFiles Value="$(ProjOutDir)"/>
      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    </SearchPaths>
    <CodeGeneration>
      <Checks>
        <IOChecks Value="True"/>
        <RangeChecks Value="True"/>
        <OverflowChecks Value="True"/>
        <StackChecks Value="True"/>
      </Checks>
      <Optimizations>
        <OptimizationLevel Value="0"/>
      </Optimizations>
    </CodeGeneration>
    <Linking>
      <Debugging>
        <DebugInfoType Value="dsDwarf2"/>
        <UseHeaptrc Value="True"/>
      </Debugging>
    </Linking>
  </CompilerOptions>
</CONFIG>
project1.lpi (1,633 bytes)   
project1.lpr (215 bytes)   
program project1;

procedure P1(A: array of Integer);
begin
end;

procedure P2(A: array of Integer);
begin
  P1(A);
end;

var
  A: array [0..2] of Integer;
  i: Integer;
begin
  for i := 0 to 10 do
    P2(A);
end.

project1.lpr (215 bytes)   

Issue History

Date Modified Username Field Change
2021-01-05 19:40 C Western New Issue
2021-01-05 19:40 C Western File Added: project1.lpi
2021-01-05 19:40 C Western File Added: project1.lpr
2021-01-10 16:48 Jonas Maebe Assigned To => Jonas Maebe
2021-01-10 16:48 Jonas Maebe Status new => resolved
2021-01-10 16:48 Jonas Maebe Resolution open => fixed
2021-01-10 16:48 Jonas Maebe Fixed in Version => 3.3.1
2021-01-10 16:48 Jonas Maebe Fixed in Revision => 48130
2021-01-10 16:48 Jonas Maebe FPCTarget => -