Pretty solid GC - if I may say so myself..

28 views
Skip to first unread message

The Beez

unread,
Feb 7, 2023, 12:17:36 PM2/7/23
to 4tH-compiler
Hi 4tH-ers!

Sometimes, when I got half an hour to kill or so, I take on a Rosetta Code task. I used to do it in 4tH, but nowadays I tend to pick it up in uBasic/4tH.

The one I took up was the "draw a clock" task. In short, it displays a digital clock:


Now, I don't want to focus on how long or short the code is - I want to focus on the time it ran. I've been running this inside a window for hours and hours - and it does its job pretty well.

But when you think of it - temporary strings are made all the time. There isn't such a thing as pointers or stuff - all strings are immutable. So several are made every second. Now, uBasic/4tH has 256 dynamic strings. If they're used the garbage collector kicks in. So every minute (or less) this thing wipes most of the strings, since every slot has been consumed.

That this has been running for hours without any problem. That means it's pretty solid. E.g. if one string leaked every minute, in 4 hours the program would quit. But it doesn't.

I find that pretty neat ;-)

Hans Bezemer
Reply all
Reply to author
Forward
0 new messages