Results 1 to 8 of 8

Thread: Memory Leak? What is it?

  1. #1
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default Memory Leak? What is it?

    I searched the forums when the moment i heard someone comment about memory leaks. But all i get is other peoples script. I notice alot of scripts get these comments and im wondering... How do you fix Memory Leaks. Because i have a script and sometimes it lags and im wondering if it has memory leaks. Mostly this part of the script lags.

    SCAR Code:
    function BurnMaples : Boolean;
    var
      FailedToLight, TinderBoxDTM, MapleDTM, tx, ty, mx, my : Integer;
    begin
      if (not (InvFull)) or (not (LoggedIn)) then Exit;
      SetChat('Off', 1);
      if (InvFull) then
      begin
        TinderBoxDTM := DTMFromString('78DA637466626078CA8002DCED38191E02694' +
                      '620FE0F048CF64035B718D000231209A4CD806A9E1050630D54F3' +
                      '81801A5FA09AD744A8B9835F0D003B9A0C70');

        MapleDTM := DTMFromString('78DA63CC65626078C28002929D79181E02694' +
                  '620FE0F048C794035B719D000231209A4E330CDC150930654F391' +
                  '809A12A09AB704D49401D53CC2AF0600D5820D99');
        repeat
          if (AntiRandoms(True)) then
            Wait(750 + Random(450));
          FindDTM(TinderBoxDTM, tx, ty, MIX1,MIY1,MIX2,MIY2);
          Mouse(tx, ty, 2, 2, True);
          Wait(480 + Random(110));
          FindDTM(MapleDTM, mx, my, MIX1, MIY1, MIX2, MIY2);
          Wait(500 + Random(440));
          Mouse(mx, my, 2, 2, True);
          if (CantLightCheck) then
          begin
            Writeln('Player can not light a fire in its current spot.');
            Mouse(MSCX+25, MSCY+25, 5, 5, True);
            Wait(335 + Random(110));
            FFlag(1);
            FailedToLight := FailedToLight + 1;
            if (FailedToLight = 5) then
            begin
              LogOut;
              Writeln('Player is having difficulties lighting a fire.');
            end;
          end;
          LightWait;
          Wait(660 + Random(410));
        until (not (ExistsItem(28)));
      end;
      LoadsDone := LoadsDone + 1;
      Total := Total + 1;
      Burned := Burned + 1;
      FreeDTM(TinderBoxDTM);
      FreeDTM(MapleDTM);
      Result := True;
      Wait(250 + Random(300));
      SetChat('On', 1);
    end;

    SCAR Code:
    function FindMaples : Boolean;
    var
      MapleTPA : TPointArray;
      MapleATPA : T2DPointArray;
      I, CTS, mx, my : Integer;
      MouseOnMaple : Boolean;
    begin
      if (not (LoggedIn)) or (InvFull) or (Slot28(True)) then Exit;
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(MSCX, MMCY, MapleTPA, 2505573, MSX1, MSY1, MSX2, MSY2, 15);
      if (Length(MapleTPA) < 1) then Exit;
      MapleATPA := SplitTPA(MapleTPA, 15);
      for I := 0 To High(MapleATPA) do
      If MiddleTPAEX(MapleATPA[i], mx, my) then
      begin
        MMouse(mx, my, 3, 3);
        Wait(715 + Random(100));
        if (IsUpText('aple')) then
        begin
          Mouse(mx, my, 0, 0, True);
          FFlag(0);
          Wait(1500 + Random(910));
          MMouse(MSCX, MSCY, 5, 5);
          FindColorSpiralTolerance(mx, my, 2505573, MSX1, MSY1, MSX2, MSY2, 15);
          MMouse(mx, my, 0, 0);
          MapleEnt;
          Wait(200 + Random(115));
          if (not (IsUpText('aple'))) then
          begin
            MouseOnMaple := False;
            Wait(440 + Random(225));
            FindColorSpiralTolerance(mx, my, 2505573, MSX1, MSY1, MSX2, MSY2, 15);
            MMouse(mx, my, 2, 2);
            if (IsUpText('aple')) then
            begin
              Mouse(mx, my, 2, 2, True);
            end;
            FFlag(0);
            MapleEnt;
            Wait(315 + Random(110));
          end;
          repeat
            if (AntiRandoms(True)) then
            begin
              Mouse(mx, my, 0, 0, True);
              RandomsSolved := RandomsSolved + 1;
            end;
            Wait(315 + Random(115));
            MMouse(mx, my, 2, 2);
            Wait(690 + Random(110));
            case (Random(4)) of
              2: Mouse(mx, my, 2, 2, True);
            end;
            AntiBan;
          until (InvFull) or (Slot28(True)) or (not (IsUpText('aple')))
          Result := True;
        end else
        begin
          Result := False;
          Exit;
        end;
      end;
    end;

    and this part seems to lag alot, so can anyone help me please? Thanks

  2. #2
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  3. #3
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default

    Lol Much?

  4. #4
    Join Date
    Apr 2007
    Location
    The Buckeye State
    Posts
    482
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Make sure that you don't you don't have SCAR define a DTM inside of a loop, that'll take up a lot of memory. Also, remember to release all your DTMs after you are done using them in the script.
    I like my coffee black just like my metal.

  5. #5
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by deathscytex View Post
    Lol Much?
    Yeah

    Well okay, that link maybe didn't help you much.

    But the truth is you don't use search
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  6. #6
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default

    didnt help much? That was more like off topic because it releated to other programmings =p

  7. #7
    Join Date
    Jun 2008
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Gotta watch them variables.

  8. #8
    Join Date
    May 2008
    Posts
    203
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    The idea when it comes to clearing memory leaks is to remove or set the used, not-needed variables to null (learned this from Warcraft III mapmaking lol). When done with a DTM, try setting the variable to null. Going to use it again? Don't delete it. That simple really.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Memory Leak?
    By Heysus in forum OSR Help
    Replies: 6
    Last Post: 12-19-2008, 12:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •