Changeset 78


Ignore:
Timestamp:
Jan 1, 2017, 12:59:53 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Show only really used memory.
  • Added: Check memory leaks in Debug build mode.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        55LazFuck
        66compiled
         7heaptrclog.trc
  • trunk/Forms/UFormMemory.pas

    r67 r78  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls;
     9  ComCtrls, Math;
    1010
    1111const
     
    4242  if Core.CurrentTarget is TTargetInterpretter then
    4343  with TTargetInterpretter(Core.CurrentTarget) do begin
    44     ListViewMemory.Items.Count := Trunc(Length(Memory) / RowSize);
     44    ListViewMemory.Items.Count := Ceil(MemoryMaxUsed / RowSize);
    4545    ListViewMemory.Refresh;
    4646  end;
     
    5454  if Core.CurrentTarget is TTargetInterpretter then
    5555  with TTargetInterpretter(Core.CurrentTarget) do
    56   if (Item.Index >= 0) and (Item.Index < Trunc(Length(Memory) / RowSize)) then begin
     56  if (Item.Index >= 0) and (Item.Index <= Trunc(MemoryMaxUsed / RowSize)) then begin
    5757    Item.Caption := IntToHex(Item.Index * RowSize, 8);
    5858    Row := '';
    5959    for I := 0 to RowSize - 1 do
    60       Row := Row + ' ' + IntToHex(Memory[Item.Index * RowSize + I], 2);
     60      if (Item.Index * RowSize + I) < MemoryMaxUsed then
     61        Row := Row + ' ' + IntToHex(Memory[Item.Index * RowSize + I], 2);
    6162    Item.SubItems.Add(Row);
    6263  end;
  • trunk/Install/deb/debian/control

    r75 r78  
    11Source: lazfuck
    22Maintainer: Chronos <robie@centrum.cz>
    3 Section: utils
     3Section: devel
    44Priority: optional
    55Standards-Version: 1.0.0
  • trunk/LazFuck.lpi

    r76 r78  
    4040            <SyntaxOptions>
    4141              <SyntaxMode Value="Delphi"/>
     42              <CStyleOperator Value="False"/>
     43              <AllowLabel Value="False"/>
     44              <CPPInline Value="False"/>
    4245            </SyntaxOptions>
    4346          </Parsing>
     
    7578            <SyntaxOptions>
    7679              <SyntaxMode Value="Delphi"/>
     80              <CStyleOperator Value="False"/>
     81              <AllowLabel Value="False"/>
     82              <CPPInline Value="False"/>
    7783            </SyntaxOptions>
    7884          </Parsing>
     
    112118            <SyntaxOptions>
    113119              <SyntaxMode Value="Delphi"/>
     120              <CStyleOperator Value="False"/>
     121              <AllowLabel Value="False"/>
     122              <CPPInline Value="False"/>
    114123            </SyntaxOptions>
    115124          </Parsing>
     
    326335        <SyntaxMode Value="Delphi"/>
    327336        <CStyleOperator Value="False"/>
     337        <IncludeAssertionCode Value="True"/>
    328338        <AllowLabel Value="False"/>
    329339        <CPPInline Value="False"/>
    330340      </SyntaxOptions>
    331341    </Parsing>
     342    <CodeGeneration>
     343      <Checks>
     344        <IOChecks Value="True"/>
     345        <RangeChecks Value="True"/>
     346        <OverflowChecks Value="True"/>
     347        <StackChecks Value="True"/>
     348      </Checks>
     349      <VerifyObjMethodCallValidity Value="True"/>
     350    </CodeGeneration>
    332351    <Linking>
     352      <Debugging>
     353        <UseHeaptrc Value="True"/>
     354      </Debugging>
    333355      <Options>
    334356        <Win32>
     
    341363        <IgnoredMessages idx5024="True"/>
    342364      </CompilerMessages>
     365      <CustomOptions Value="-dDEBUG"/>
    343366    </Other>
    344367  </CompilerOptions>
  • trunk/LazFuck.lpr

    r75 r78  
    1313  UFormOutput, UFormInput, UFormMemory, UFormMessages, UFormSourceCode,
    1414  UFormTargetCode, UFormTargetOptions, UCore, Common, TemplateGenerics,
    15   CoolTranslator, UFormLog, UProject, UBFTarget;
     15  CoolTranslator, UFormLog, UProject, UBFTarget, SysUtils;
    1616
    1717{$R *.res}
    1818
     19{$IFDEF DEBUG}
     20const
     21  HeapTraceLog = 'heaptrclog.trc';
     22{$ENDIF}
     23
     24
    1925begin
     26  {$IFDEF DEBUG}
     27  // Heap trace
     28  DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     29  SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     30  {$ENDIF}
     31
    2032  Application.Title := 'LazFuck IDE';
    2133  RequireDerivedFormResource := True;
  • trunk/Target/UTargetInterpretter.pas

    r72 r78  
    228228  if MemoryPosition < MemorySize then Inc(MemoryPosition, FProgram[FProgramIndex].Parameter)
    229229    else raise Exception.Create(SProgramUpperLimit);
     230  if MemoryPosition > MemoryMaxUsed then
     231    MemoryMaxUsed := MemoryPosition;
    230232end;
    231233
     
    253255  OutputPosition := 1;
    254256  MemoryPosition := 0;
     257  MemoryMaxUsed := 0;
    255258  //FillChar(Pointer(Memory)^, Length(Memory), 0);
    256259  for I := 0 to Length(Memory) - 1 do
  • trunk/UBFTarget.pas

    r70 r78  
    3434  public
    3535    MemorySize: Integer;
     36    MemoryMaxUsed: Integer;
    3637    CellSize: Integer;
    3738    constructor Create; override;
Note: See TracChangeset for help on using the changeset viewer.