Beware the GC

BlitzMax Forums/BlitzMax Bug Reports/Beware the GC

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

2 TomToad
To protect list from GC, if u don't want use it as regular, is declare it as global var. See my first sample. Or use trick below.

2 Azathoth
Then you don't understand errors in code by Otus. I showed it already. Or u don't understand what 'l' don't use in code after "Local link:TLink = l.FirstLink()"? And any references to list not exist after this?
Well how about this code, when 'l' REALLY still reference until end of program:
SuperStrict
Framework BRL.StandardIO
Import BRL.LinkedList

Local l:TList = New TList
l.AddLast "Hello "
l.AddLast "World"

Local link:TLink = l.FirstLink(), s:String

For Local i:Int = 1 To 1000000
	s = String(link.Value())
	link = link.NextLink()
	s:+ String(link.Value()) 
	link = link.PrevLink()
	Print s
Next
Print l.count();

Just write right and clean code and all be OK ;P
Use Global for global variables and don't declare global variables as local.