Why does deleting a game object created by a factory cause a memory leak? (SOLVED)

I don’t understand why this causes a “sprite buffer full” message:

	for i=1, 100 do
		local hill = factory.create( hill_url )
		go.delete( hill, true )
	end

Help!

This is for testing, of course, but I assumed an object created by a fabric is destroyed when go.delete is used?

The game objects will not get immediately deleted. They will be deleted at the end of the frame.

2 Likes

Oj, found the cause of the (UNRELATED) leak in my code.

I had used this:

local hill_url = msg.url( hill )
go.delete( hill_url, true )

Instead of just this:

go.delete( hill, true )

For some reason. And although the hills were removed visually, the “spritec” count kept going up.

Oh, hmm, really? That shouldn’t matter. Could you please create a small repro and share here?

After trying, and failing, to make a minimal project, I went back to the game to make sure I wasn’t seeing things. It seems that I was seeing things. :roll_eyes:

I think it must have been the “recursive” flag that was missing before. Sorry for the red herring.

2 Likes