The Garbage Collector: Very Bad

BlitzMax Forums/BlitzMax Beginners Area/The Garbage Collector: Very Bad

I'm must be particularly dense tonight, but I don't understand how...

BMAX
Strict

Type TMyType
	Global list:TList = New TList
	
	Field id
	Field value
	
	Method New()
		list.AddLast(Self)
	End Method
End Type

For Local c = 1 To 10
	Local t:TMyType = New TMyType
	
	t.id = c
	t.value = Rand(100)
	
	Print t.id + " - " + t.value
Next

Local id1:TMyType, id8:TMyType

For Local t:TMyType = EachIn TMyType.list
	If t.id = 1 Then id1 = t
	If t.id = 8 Then id8 = t
Next

Print
Print "id1 = " + id1.id + " - " + id1.value
Print "id8 = " + id8.id + " - " + id8.value 

End


...is going to be substantially slower than...

BB
Type TMyType
	Field id
	Field value
End Type

For c = 1 To 10
	t.TMyType = New TMyType
	
	t\id = c
	t\value = Rand(100)
	
	Print t\id + " - " + t\value
Next

For t.TMyType = Each TMyType
	If t\id = 1 Then id1.TMyType = t
	If t\id = 8 Then id8.TMyType = t
Next

Print
Print "id1 = " + id1\id + " - " + id1\value
Print "id8 = " + id8\id + " - " + id8\value 

WaitKey()

End


??

[edit]
Mordax_Praetorian, try importing the above BB code into the BMax IDE to see what you get.
[/edit]