bg5
2012-05-11 03:02:48
I was testing this little script ,when it was interrupted by very unexpected error:

Warning : running this script will likely crash your simba and flood your RAM.
Taken memory value was growing up during script run ,and it wasn't freed (from RAM),when script was executed. After investigation I found the culprit:
Changing
and

Conclusion:
I didn't test it ,but I suspect more functions may have leaks.
It was said before ,that wrappers theoretically increases function's speed. But no one said ,that using functions without wrappers is dangerous and can explode your RAM!
Error: Exception: Out of memory at line 21Simba has eaten my memory:Warning : running this script will likely crash your simba and flood your RAM.
program new;
{$I SRL/srl.simba}
{$I srl/srl/misc/debug.simba}
procedure FPP_test(const SD, ED, MinR, MaxR: Extended);
var
a ,bmp,w,h,radius ,t:integer;
tpa,temp :TPointarray;
M : TPoint;
begin
w := 300;
h := 300;
M := Point (w/2,h/2);
radius := (min(w,h))/2-10;
bmp := CreateBitmap(w,h);
for a:= 0 to radius do
begin
temp := TPAFromCircle(m.x,m.y,a);
tpa := combineTPA(tpa,temp);
end;
DrawTPABitmap(bmp,tpa,clWhite);
FilterPointsPie(tpa,SD, ED, MinR, MaxR,m.x,m.y);
DrawTPABitmap(bmp,tpa,clred);
Debugbitmap(bmp);
FreeBitmap(bmp);
end;
var
a,b : integer;
begin
for a:= 0 to 360 do
FPP_test(a,a+5,1,150);
end.Taken memory value was growing up during script run ,and it wasn't freed (from RAM),when script was executed. After investigation I found the culprit:
Changing
tpa := combineTPA(tpa,temp); tocombineTPAWrap(tpa,temp,tpa);decreased memory leak:temp := TPAFromCircle(m.x,m.y,a); TPAFromCircleWrap(m.x,m.y,a,temp);eliminated it fully:Conclusion:
I didn't test it ,but I suspect more functions may have leaks.
It was said before ,that wrappers theoretically increases function's speed. But no one said ,that using functions without wrappers is dangerous and can explode your RAM!