Delete & References

BlitzMax Forums/BlitzMax Programming/Delete & References

Otus(Posted 2008) [#1]
Note to self: never create new references in Delete methods.
SuperStrict

Framework BRL.StandardIO

Type TTest
	Global last:TTest
	
	Method Delete()
		last = Self
	End Method
End Type

For Local i% = 1 To 1000
	New TTest
Next

I was doing something more complicated, where a temporary reference was created as a side effect. Serious debugging ensued as the error message came up wherever garbage collection happened to happen.

At least I now know what "clrMemBit error: membit not set" means...


ziggy(Posted 2008) [#2]
Don't add a reference to an object being deleted by the GC! that's completelly expected. I think the error message could me much more explanatory.