Login
Back to forumReply to this topicGo to last reply

Posted By

SVS
on 2020-09-18
06:49:03
 How to detect a Garbage collecting operation?

I'm coding a program that deeply involve the timing of the calculations. Since it is Basic compiled with Austrospeed, I should detect *when* the O.S. performs an automatic Garbage Collection of the strings.
Does anybody know a way to find out this?

Posted By

RoePipi
on 2020-09-18
11:41:49
 Re: How to detect a Garbage collecting operation?

I might have a method...
Since I don't like when my programs freeze while an inevitable garbage collection happens, I issue a X=FRE(.) statement at every point of the code where a little (sub-second) delay is allowable, like after preparing the next level in a game, just before the main loop starts.
However, I wanted to know how often garbage collection happens, so I did a little research and came up with this formula:

display free memory without garbage collection:
?PEEK(51)-PEEK(49)+256*(PEEK(52)-PEEK(50))

It tells you how many bytes left till the next garbage collection. Displaying this as debug info, you can estimate the remaining time it occurs next.

Hope I could help.

Posted By

SVS
on 2020-09-19
07:29:07
 Re: How to detect a Garbage collecting operation?

@RoePipi: Thank you for yr reply.
Actually I have put a similar formula in order to view when the automatic Garbage Collections starts.
The odd fact is that, even if the program runs the same algorithm, it seems that the Garbage Collection launch happens more often as time passes. The quantity of free memory remains the same.



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024