SRL Archive - OSR Help

Overshooting Memory?


moneyman331

2013-08-03 13:22:14

Somehow I'm overshooting the memory limit (I think) and getting negative bars per hour and all sorts of crazy stuff happening as my script gets farther and farther along. Any ideas on how to fix this?


MEPH:= ((5*53*n*3600)/(GetTimeRunning/1000));
writeln('meph: '+IntToStr(meph));
SEPH:= ((5*30*n*3600)/(GetTimeRunning/ 1000));
writeln('seph: ' + IntToStr(seph));
bph:=5*3600000*n/GetTimeRunning;
writeln('bars completed per hour: '+IntToStr(bph));
writeln('bars completed: '+IntToStr(5*n));

Brandon

2013-08-03 13:30:46

You mean your integer is overflowing and please edit your post and remove that extremely long log.. it's very difficult to even reply.

To avoid integer/data overflows, you need to use a larger type or fix your algorithm to not store the results of extremely high numbered arithmetic.

Also, since time cannot be negative, it'd be a good idea to start using unsigned types.


Integer = –2,147,483,648 ------> 2,147,483,647
Cardinal = 0 ------> 4,294,967,295


Int64 = –9,223,372,036,854,775,808 -----> 9,223,372,036,854,775,807
Unsigned Int64 = 0 ------> 18,446,744,073,709,551,615

moneyman331

2013-08-03 13:35:57

Sorry about that, I thought spoiler tags were on the board so you could click to open / close it.

Thanks! Going to look into that now…

masterBB

2013-08-03 14:06:39

MEPH := ((5.0*53*n*3600)/(GetTimeRunning/1000));
writeln('meph: '+IntToStr(meph));
SEPH := ((5.0*30*n*3600)/(GetTimeRunning/ 1000));
writeln('seph: ' + IntToStr(seph));
bph:= 5.0 * 3600 * n / GetTimeRunning * 1000;
writeln('bars completed per hour: '+IntToStr(bph));
writeln('bars completed: '+IntToStr(5*n));

Try this. if it still doesn't work consider multiplying by 3600 after dividing it by the time.