I've tried some old GWBasic code of mine dating back to the early eighties, and I ran in a problem related to string memory garbage collection. My program itself computes decimal development of fractions, nothing really interesting there, but when running extended tests, I got an "Out of string space" error, while at any point in time my code never actually stores more than few strings with less than 1000 characters.
Here is an ultra simplified variant showing the issue:
Thoreau BASIC v2.
16,642,736,128 bytes free.
Ready.
load "outofmem
Ready.
list
10 for n=1 to 1000000
20 s$=""
30 for i=1 to 100
40 s$=s$+"12345678"
50 next
60 next
Ready.
run
Out of string space in 40
Ready.
? n, fre(0)
205975 480
Ready.
It repeatedly build a 800-char string by accumulation, then clear the string and loop.
I don't know how dynamic memory is managed internally (reference counting or dynamic reference exploration) but I would have expected that freed string memory would be reclaimed/recycled at some point.
It's not critical since it's just stress testing/performance testing part of my code that's impacted, just wanted you to know.