# Flixel text causing memmory leak (FlxText) - AS3

I am calling kill() and destroy() on flxText when i dont need it anymore, how come its still using the memmory it let the game run for a while it went up to 1,5 gig of ram, then i commented it out the code where flxText is made and got this http://shrani.najdi.si/?3u/x6/1MkFPi08/fac.png (using only 170m-190m), so its obviously flixel text not cleaning up propperly , wat do ?

Hi Matthew and thank you for your question.

Since ActionsScript uses garbage collection there are only 2 reasons.

First you have references to these objects in your own objects or from a manager in fixel. In this case be aware to null your references. Maybe the tool mentioned here could be useful.

Second your garbage collection did not trigger automatically. In this case force it to clean up. Sometimes garbage collection can not or need many attempts to free all memory. This is caused by circular references. I.e. A references B and B references A and you null the reference to A.

So what to do. Check if you really null your references and that no reference is left from your side of code. If the problem continuous check if flixel tracks some references internally and lookup how to remove them. If the problem is not solved check for objects that reference each other. Normally this should not cause this problem because garbage collection checks for circular references.

I've found it helps to set all references for objects to null on destroy.