Whys it causing a memory leak? (types and lists)

BlitzMax Forums/BlitzMax Beginners Area/Whys it causing a memory leak? (types and lists)

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.

Hey peeps

this is a particle system that i made for that supernova2d game i did. It played fine, but when i checked on my memory, i got a leak... This is the code that matters from it and the leak is still present...

Why am i getting this leak and how do i stop it!? cheers peeps :D

Global bullet_list:TList=New TList
Global particle_list:TList=New TList


Type particle
Field x#,y#
Field c#,d#
Field xforce#,yforce#
Field life
Field maxlife
Field Order
Field angle
Field anglespread
Field damp#
Field lastx,lasty
Field lastdone
End Type

Type bullet

Field from
Field x#,y#
Field c#,d#
Field life
End Type

repeat

For n=1 To 1024
p:particle=New particle
ListAddLast particle_list,p
p=Null
Next

For p:particle=EachIn particle_list
ListRemove particle_list,p;Release p
p=Null
Next

Print MemAlloced()
flushmem
Flip
Cls
Until KeyDown(key_escape)