Will this free up memory correctly?

BlitzMax Forums/BlitzMax Programming/Will this free up memory correctly?

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.

Couple things Grey. Not sure I understand what your Remove is doing but it is freeing the entire list. So you could just all trackerlist.clear()

That method removes all the tlinks so all the Particles get marked for collection and its faster than a foreach remove.

Also when adding to a TList like this use AddFirst as AddLast the entire TList needs to be run before the object will be appended so if you have a 1000 particles the entire list will be scanned before you add the 1001st particle.

Another suggestion is to not use a TList at all but create your own link structure and create Particle pools. One pool for active particles and one for for inactive particles. That way you allocate the max you want up front. Speed wise it blows away a TList.

My DX9 Driver demo uses the technique.

Doug Stastny