Smalltalk & Garbage Collection

garbage-collection, smalltalk

Solution

Yes, the reference count will go to zero when you reassign the transaction variable, and the previously-referenced object will be cleaned up forthwith.

Problem

Smalltalk has automatic garbage collection right? So, is that to say that I can do something like the following with no unexpected side-affects? ``` transactions := Set new. transactions add: tran1. transactions add: tran2. transactions add: tran3. transactions add: tran4. ... transactions add: tran899. transactions add: tran900. ||| ~~ Do some stuff ~~ ||| transactions post. transactions := Set new. ```

Original source