I don't think Var was a good idea.

BlitzMax Forums/BlitzMax Programming/I don't think Var was a good idea.

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.

I don't know if it is leaving anything around... It might be simply failing to call the Delete method at times.

Type Sprite
	Global SpriteRenderList:TList = New TList
	Global gid:Int = 0
	
	Field id:Int = gid

	Method New()
		gid:+1
		ListAddLast SpriteRenderList, Self
	End Method
	
	Method Delete()
		Print "REF CLEANED:id "+id
	End Method

	Method Remove()
		ListRemove SpriteRenderList, Self
		Print "Removed id "+id+", "+CountList(SpriteRenderList)+" total sprites now remaing"
	End Method
			
End Type

Local mt:Sprite = New Sprite
Local mt2:Sprite = New Sprite
Local mt3:Sprite = New Sprite

Print "id>"+mt.id
Print "id>"+mt2.id
Print "id>"+mt3.id

Print CountList(Sprite.SpriteRenderList)
mt.Remove; mt=Null; GCCollect() 

Print CountList(Sprite.SpriteRenderList)
mt2.Remove; mt2=Null; GCCollect()

Print CountList(Sprite.SpriteRenderList)
mt3.Remove; mt3=Null; GCCollect()

Print CountList(Sprite.SpriteRenderList)

GCCollect()
GCCollect()

End



The list is empty at least. But that doesn't mean types haven't been left in ram.