Mem leack in my particle emittor code.

BlitzMax Forums/BlitzMax Beginners Area/Mem leack in my particle emittor code.

I dont think you are understanding how the garbage collector works. Yes, setting the programs only reference to a tpe to null will free it - but you must lose all methods of accessing the particle. The problem is that you are getting a reference from another source and then nullifying it. this does nothing. There is still a reference within the linked list to it.

Solution is to replace the code in destroy with:

particle_list.clear


you could nullify the list, flushmem and recreate but this is way cleaner