Freeing Memory?

BlitzMax Forums/BlitzMax Programming/Freeing Memory?

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.

Interesting, I added a bunch of de-allocation code and it help the performance when you start a game over and over. In fact I was able to get the memory reported by GCMemAlloced() up to 3,900,000 bytes without any noticeable performance loss.

However, the memory reported by GCMemAlloced() is still increasing. That kind of makes me think that somehow memory can be lost by GCMemAlloced()?

Anything below you can see that I overlooked:


'Destory the Game Play View Screen
Method Destroy()              
	Local pTPlayer:TPlayer = Null
	     
	Print "TGamePlayScreen.Destroy"
		
	SetImageFont Null  
        
        'Null the Player's Avatar
        m_pTPlayersAvatar.Destroy()
        m_pTPlayersAvatar = Null
        
        'Null the Tile Maps.
	m_pTTileMapLayer1 = Null
	m_pTTileMapLayer2 = Null
	m_pTTileMapLayer3 = Null
		
	'TODO - Need to Implement Destroy for the Tile Maps.
		
	'Destroy the Player's Avatar. 
	m_pTStarship.Destroy() 
	m_pTStarship = Null
		
	'Remove the Players from the List.
	For pTPlayer = EachIn m_pTPlayerList
            
		'Destory the Players.  
		m_pTPlayerList.Remove(pTPlayer)
		pTPlayer.Destroy()
	pTPlayer = Null	
			
	Next 

	'Null the Players List.
	m_pTPlayerList.Clear()
	m_pTPlayerList = Null
	
	'Null the Galaxy.
	m_pTGalaxy.Destroy() 
	m_pTGalaxy = Null
		
	'Null the Weapons Menu.
	If m_pTWeaponsMenu <> Null
		m_pTWeaponsMenu.Destroy()
		m_pTWeaponsMenu = Null
	End If

End Method


Also, does calling GCCollect() in automatic mode do anything?

Thanks