SRL Archive - Help

Memory Buildup?


Itankbots

2013-02-07 19:26:07

I noticed when i ran simba over night, the Memory usage for it after 12hours had nearly tripled. I Dont remember this happening a couple months ago when i used it before.
Is there anything i can do to Stop simba from building up so much memory? after A couple days it really effects how the script is running and how many i can run on 1 computer.

-Thanks

i luffs yeww

2013-02-07 20:02:35

What script were you using?

NKN

2013-02-07 20:20:16

Some TPA functions, and SMARTGraphics has mem leaks.

Post the script.

Itankbots

2013-02-07 20:32:17

function FindHide: boolean;
var
i : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
Box : TBox;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.62, 4.32);

if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 15133427, MSX1, MSY1, MSX2, MSY2, 4) then
begin
ATPA := TPAtoATPAEx(TPA, 15, 15);
SortATPASize(ATPA, True);
for i := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[i]);
Box := IntToBox((MP.X - 20), (MP.Y - 20), (MP.X + 20), (MP.Y + 20));
MMouse(MP.X, MP.Y, 4, 4);
Result := True;
Break;
end;
end;
end;



Theres the script, It might be the TPA functions but idk what is causing the memory leak, any help would be appreciated.

NKN

2013-02-08 16:34:38

Replace the TPA functions with Wrappers

Itankbots

2013-02-09 00:03:45

Is this what you mean by wrappers? ive never used them before, just looked it up on the forums :c

function FindHide: boolean;
var
i : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
Box : TBox;
tmpCTS : Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.62, 4.32);

if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 15133427, MSX1, MSY1, MSX2, MSY2, 4) then
begin
TPAtoATPAExWrap(TPA, 15, 15, ATPA);
SortATPASize(ATPA, True);
for i := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[i]);
Box := IntToBox((MP.X - 20), (MP.Y - 20), (MP.X + 20), (MP.Y + 20));
MMouse(MP.X, MP.Y, 4, 4);
Result := True;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Break;
end;
end;
end;

Should that stop the memory buildup?

DannyRS

2013-02-09 02:28:04

From: Itankbots
Is this what you mean by wrappers? ive never used them before, just looked it up on the forums :c

Should that stop the memory buildup?


They work around the interpreter bug that causes array leaks, so using wrap functions Should stop most if not all memory leaking problems

Itankbots

2013-02-09 04:53:48

From: DannyRS
They work around the interpreter bug that causes array leaks, so using wrap functions Should stop most if not all memory leaking problems


Alright, Thanks for the help guys! It seems to have worked ^.^