I still say that max's memory mangement is insane.

BlitzMax Forums/BlitzMax Programming/I still say that max's memory mangement is insane.

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.

Sorry, I haven't read all you posts. But I would recommend the following to avoid Memory Leaks:

Type YourType
	Field bIsDeleted:Byte
	
	Method Remove:Byte()
		If bIsDeleted = False Then
			'Place your One-Time-Deleting-Actions here.
			'For Example: Removing Object from global List.
		End If
		bIsDeleted = True
		
		Return Tru
	End Method
	
	Function DeleteCheck:Byte(objVarCheck:YourType)
		If objVarCheck = Null Then Return False
		If objVarCheck.bIsDeleted = True Then
			objVarCheck = Null
		End If
		Return True
	End Function
End Type


Now all you have to do is checking every Link to an YourType once a Frame with Deletecheck. Simply "DeleteCheck(YourLink)". If you also want to know, whether the Object was Deleted in this Frame or not, use this:

Local objTemp:YourType = objRealLink2Check
If YourType.DeleteCheck(objTemp) = True And objTemp = Null Then
	'Now do your Deleting-Actions you need objRealLink2Check for.
	objRealLink2Check = Null
End If


If you don't need the Link for you Final Action, the following will do:

If YourType.DeleteCheck(objRealLink2Check) = True And objRealLink2Check = Null Then
	
End If