SRL Archive - OSR Help

Memory leaking problem, but isn't associated with DTM


freezeyp

2012-10-28 05:28:34

I'm sure that I have put the procedure that free DTM in AddOnTerminate, and never got error when stopping the script. However, my simba still getting larger as the script running. Is there some real example about the leaking memory? Best to have the solution too.

Enslaved

2012-10-28 05:36:07

are there a lot of tpas in the script, every time a tpa is declared, memory is assigned to it i believe

speedster

2012-10-29 07:34:25

Not exactly true, there are some functions that clog the memory with TPA - I don't know exactly which of those are, but I had to rethink a few functions in order to get one of my scripts to be memory leak free.

Markus

2012-10-29 07:38:56

This is what I used to fix it in my essminer. Keep in mind that I only added the TPA functions which were required by the miner, so a couple you might use could be missed.
Add line above the srl/srl.simba include. It'll override a couple of functions.

{$IFDEF RAYMONDPOWNS} {DONT TOUCH THIS LINE, IT FIXES CODE 8. The define is an undocumented define for Pascalscript as there is no documented one.} function SplitTPA(arr : TPointArray; dist : Integer) : T2DPointArray; begin SplitTPAWrap(arr, dist, result); end; function SplitTPAEx(arr : TPointArray; w, h : integer) : T2DPointArray; begin SplitTPAExWrap(Arr, w, h, result); end; function ClearTPAFromTPA(arP, ClearPoints : TPointArray) : TPointArray; begin ClearTPAFromTPAWrap(arP, ClearPoints, result); end; function TPAToATPAEx(arP : TPointArray; w, h : integer) : T2DPointArray; begin TPAtoATPAExWrap(arP, w, h, result); end; function TPAToATPA(arP : TPointArray; dist : Integer) : T2DPointArray; begin TPAtoATPAWrap(arP, dist, result); end; function FindGapsTPA(TPA : TPointArray; MinPixels : integer) : T2DPointArray; begin FindGapsTPAWrap(tpa, MinPixels, result); end; {$ENDIF}
Note that this is the ugly fix. The real fix is either to use Lape or use the wrappers (every function which returns a (A)TPA also has a Wrap function).

freezeyp

2012-10-29 23:41:41

From: Markus
This is what I used to fix it in my essminer. Keep in mind that I only added the TPA functions which were required by the miner, so a couple you might use could be missed.
Add line above the srl/srl.simba include. It'll override a couple of functions.

{$IFDEF RAYMONDPOWNS} {DONT TOUCH THIS LINE, IT FIXES CODE 8. The define is an undocumented define for Pascalscript as there is no documented one.} function SplitTPA(arr : TPointArray; dist : Integer) : T2DPointArray; begin SplitTPAWrap(arr, dist, result); end; function SplitTPAEx(arr : TPointArray; w, h : integer) : T2DPointArray; begin SplitTPAExWrap(Arr, w, h, result); end; function ClearTPAFromTPA(arP, ClearPoints : TPointArray) : TPointArray; begin ClearTPAFromTPAWrap(arP, ClearPoints, result); end; function TPAToATPAEx(arP : TPointArray; w, h : integer) : T2DPointArray; begin TPAtoATPAExWrap(arP, w, h, result); end; function TPAToATPA(arP : TPointArray; dist : Integer) : T2DPointArray; begin TPAtoATPAWrap(arP, dist, result); end; function FindGapsTPA(TPA : TPointArray; MinPixels : integer) : T2DPointArray; begin FindGapsTPAWrap(tpa, MinPixels, result); end; {$ENDIF}
Note that this is the ugly fix. The real fix is either to use Lape or use the wrappers (every function which returns a (A)TPA also has a Wrap function).


Thanks, I'll take a try.
By the way, the only stuff that using atpa in my script is the bank opening. So is the standard bank opening method lead to memory leaking?