Memory leak :/

BlitzMax Forums/BlitzMax Beginners Area/Memory leak :/

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.

My first topic here so hello to anybody I know from irc/blitzcoder.com, but back to the topic:

I just got Blitzmax and all that and Ive started with simple particle thing. The thing is that Ive got memory leak :/.
Check the shortly code: (Doesnt require media)

Strict

Const ScreenWidth = 640,ScreenHeight = 480,ScreenDepth = 16,ScreenHerz = 60

Const Gravity# = 0.1

Const ParticleCount = 200

Global Particles

Global ParticleList:TList = New TList

'FPS
Global FPS,ShowFPS,FPSTimer

Type Particle
	Field X#,Y#
	Field XAcc#,YAcc#
	Field Life
	
	Method Update()
		YAcc# = YAcc# + Gravity#
		X# = X# + XAcc#
		Y# = Y# + YAcc#
		Life = Life - 1
		Plot X#,Y#
	End Method
	
	Function CreateParticle(PX#,PY#,PLife)
		Local P:Particle = New Particle
		P.X# = PX#
		P.Y# = PY#
		P.Life = PLife
		
		P.XAcc# = -1 + Rnd(2) 
		P.YAcc# = 1+Rnd(1)
		ParticleList.AddLast P
		
		Particles :+1
	
	End Function
End Type


Load
Main

Function Load()
	Graphics ScreenWidth,ScreenHeight,ScreenDepth,ScreenHerz
End Function 

Function Main()
	Local Loop

	Repeat
		For Loop = 1 To ParticleCount
			Particle.CreateParticle(Rand(ScreenWidth),0,90)
		Next
		UpdateParticles()
		UpdateFPS()
		DrawText "Particles: " + Particles,0,15
		DrawText "Memory: " + MemAlloced(),0,30
		Flip
		Cls
		FlushMem
	Until KeyHit( KEY_ESCAPE )
End Function

Function UpdateParticles()
	SetColor(0,0,255)
	For Local P:Particle = EachIn ParticleList
		P.Update()
		If P.Life = 0 Then
			ListRemove(ParticleList,P:Particle)
			Particles :-1
		EndIf
	Next
End Function

Function UpdateFPS()
	FPS = FPS + 1
	If MilliSecs() > FPSTimer + 999 Then
		ShowFPS = FPS
		FPS = 0
		FPSTimer = MilliSecs()
	EndIf
	SetColor(255,255,255)
	DrawText "FPS: " + ShowFPS,0,0
End Function


Memory just keeps running :/