Hacker News new | past | comments | ask | show | jobs | submit login

Lisp and Smalltalk and BASIC (to name a few) were popular languages before the JVM that used GC.



When I was in high school, I wrote a Z80 disassembler in BASIC and printed out the entire TRS-80 Model 3 ROM on a thick stack of fan folded greenline paper. I spent a lot of free time figuring out what was what and commenting the code by pen in the right margin.

The (string) garbage collector was amazingly frugal and correspondingly slow. Because the garbage collector typically ran only when memory was critically low it used almost no memory, just 4 bytes I think. (it was also possible to invoke it any time with the FRE(0) function call IIRC)

The routine would sweep all of the symbol table and expression stack looking for string pointers, and would remember the lowest (highest? I forget which) string base address which hadn't already been compacted. After each pass it would move that one string and fix the symbol table pointer (or expression stack str pointer) then do another pass. As a result, is was quadratic with the number of live strings -- so if you had a large number of small strings, it was possible for your program to lock solidly for 30 seconds or more.


Your description closely matches what is described here: https://en.wikipedia.org/wiki/Garbage_collection_(computer_s...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: