Memory leak removeChild()

I recently discovered that the reason behind our App crashing consistently after running for some minutes is the removeChild() function that doesn’t quite seem to do its job.

Here is a simple class that on each frame adds and removes a bunch of sprites, onto those sprites I paint some rectangles with different alpha values. There are no references that I store, so GC should free the sprites up after I remove them from the stage, but instead the memory used creeps up to 1-2GB within a few seconds. Just to make sure that GC is actually triggered there is also the possibility to clear the screen and then trigger GC by clicking onto the stage, but that doesn’t free up the memory used either.

Thanks in advance for any help.

Quick update:
to solve the issue described above I am using objectpools now, not ideal, but does the job.

Another thing that is leaking absurdly, if you repeatedly call:

Perhaps calling graphics.clear() on sprite before removing it would help?

ah dont get me wrong I am not removing the sprite for the graphics.lineTo leak that is an additional leak. To reproduce it just repaint the graphics.line every frame and you will get massive leaks on windows, ios & android

Yep, same here. If I add a trace after clear() it seems to help.