Defold 1.6.4 Beta

I haven’t taken a look yet, I’ll try to do it today :+1:

EDIT: I think I’ve found the issue, a fix is on the way

3 Likes

We’ve pushed two fixes to the beta, and will be available for testing within an hour:

  • a fix for the sprite flip issue when using trimmed sprite images
  • a reference count issue when using the buffer type
6 Likes

Yes, this is a bug. We will fix that.

2 Likes

Great, thanks!

Some of leaks fixed.
This is fixed.

mesh.buffer_res = resource.create_buffer("/def-mesh/buffers/buffer" .. RES_BUFFER_IDX .. ".bufferc", { buffer = buf, transfer_ownership = true })

This not. No transfer_ownership?
Creation

	local name = "/runtime_buffer_water_" .. M.water.idx .. ".bufferc"
	local new_buffer = resource.create_buffer(name, { buffer = water_create_default_native_buffer() })

later when change buffer

	resource.set_buffer(e.water_buffer.buffer, buffer, { transfer_ownership = true })

But now sometimes i see leaked, sometime not.
When i change location(delete old water, create new water)

i see leaked. But every time it different. Sometimes i not see any leaks. Sometimes part of buffer leaks.

ERROR:RESOURCE: Leaked resources:
ERROR:RESOURCE: Resource: /runtime_buffer_water_5.bufferc  ref count: 1
ERROR:RESOURCE: Resource: /runtime_buffer_water_1.bufferc  ref count: 1
ERROR:RESOURCE: Resource: /runtime_buffer_water_2.bufferc  ref count: 1
ERROR:RESOURCE: Resource: /runtime_buffer_water_3.bufferc  ref count: 2
ERROR:RESOURCE: Resource: /runtime_buffer_water_4.bufferc  ref count: 1
ERROR:RESOURCE: Leaked resources:
ERROR:RESOURCE: Resource: /runtime_buffer_water_5.bufferc  ref count: 2
ERROR:RESOURCE: Resource: /runtime_buffer_water_4.bufferc  ref count: 2
1 Like

Do I need to do something specific to make the game create all of these? I just ran the project and closed it, and the two leaks originally posted were fixed. So I think I need more information on how to repro this. Or a smaller repro

1.This happened when i change location.
Look at video link.
1)Open game
2)Run in green rect. Stop.
3)Choose battle
4)Run back to lose
5)Return to hub location.
6)Close game

2.Add new code. So now it happened when you close game.
game_world.lua. Look at commit “add test to fix leaked”

--create 5 waters
	local waters_test = {}
	local FACTORY_URL = msg.url("game_scene:/factory#water")

	local PARTS = {
		ROOT = COMMON.HASHES.hash("/root"),
		MESH = COMMON.HASHES.hash("/mesh"),
	}

	local function water_create_default_native_buffer()
		return buffer.create(1, {
			{ name = hash("position"), type = buffer.VALUE_TYPE_FLOAT32, count = 3 },
			{ name = hash("normal"), type = buffer.VALUE_TYPE_FLOAT32, count = 3 },
			{ name = hash("texcoord0"), type = buffer.VALUE_TYPE_FLOAT32, count = 2 },
		})
	end

	for i = 1, 5 do
		local e = { }
		local collection = collectionfactory.create(FACTORY_URL, vmath.vector3(1))

		local name = "/leaked buffer" .. i .. ".bufferc"
		local new_buffer = resource.create_buffer(name, { buffer = water_create_default_native_buffer() })
		
		e.water_buffer = {
			name = name,
			buffer = new_buffer
		}

		e.water_go = {
			root = msg.url(assert(collection[PARTS.ROOT])),
			mesh = nil
		}
		e.water_go.mesh = COMMON.LUME.url_component_from_url(e.water_go.root, "mesh")
		-- assign cloned buffer to a mesh component
		go.set(e.water_go.mesh, "vertices", e.water_buffer.buffer)
		print("create water buffer", e.water_buffer.name)
		table.insert(waters_test, e)
	end

	for _, w in ipairs(waters_test) do
		print("delete water buffer", w.water_buffer.name)
		assert(w.water_go)
		go.delete(w.water_go.root, true)
		w.water_go = nil
		w.water_buffer = nil
	end
	collectgarbage("collect")
	collectgarbage("collect")
	collectgarbage("collect")
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:97: create water buffer	/leaked buffer1.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:97: create water buffer	/leaked buffer2.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:97: create water buffer	/leaked buffer3.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:97: create water buffer	/leaked buffer4.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:97: create water buffer	/leaked buffer5.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:102: delete water buffer	/leaked buffer1.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:102: delete water buffer	/leaked buffer2.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:102: delete water buffer	/leaked buffer3.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:102: delete water buffer	/leaked buffer4.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/game_world.lua:102: delete water buffer	/leaked buffer5.bufferc
DEBUG:SCRIPT: [INFO 14:45:12] GameSceneController: scenes/game/game_scene_controller.script:15: total level load:0.42450660000031
DEBUG:SCRIPT: [INFO 14:45:12] ContextManager: libs/contexts_manager.lua:86: Context register:GAME_GUI
DEBUG:SCRIPT: [INFO 14:45:12] ContextManager: libs/contexts_manager.lua:86: Context register:GAME_WORLD_GUI
DEBUG:SCRIPT: [INFO 14:45:12] Render: render/my.render_script:149: screen size changed. from w:1200 h:675 to w:1440 h:810
DEBUG:SCRIPT: [INFO 14:45:12] none: world/game/ecs/systems/draw_interact_aabb_system.lua:53: ZONE
DEBUG:SCRIPT: [INFO 14:45:12] SCENE: libs/sm/scene.lua:95: GameScene show
DEBUG:SCRIPT: [INFO 14:45:12] SCENE: libs/sm/scene.lua:115: GameScene resumed
DEBUG:SCRIPT: [INFO 14:45:13] ContextManager: libs/contexts_manager.lua:99: Context unregister:MAIN
DEBUG:SCRIPT: [INFO 14:45:13] ContextManager: libs/contexts_manager.lua:99: Context unregister:TOP_PANEL
DEBUG:SCRIPT: [INFO 14:45:13] ContextManager: libs/contexts_manager.lua:99: Context unregister:GAME
DEBUG:SCRIPT: [INFO 14:45:13] none: def-mesh/texture.lua:97: free texture:[/__anim_bones_Character.002_2.texturec]
DEBUG:SCRIPT: [INFO 14:45:13] ContextManager: libs/contexts_manager.lua:99: Context unregister:GAME_GUI
DEBUG:SCRIPT: [INFO 14:45:13] ContextManager: libs/contexts_manager.lua:99: Context unregister:GAME_WORLD_GUI
DEBUG:SCRIPT: [INFO 14:45:13] ContextManager: libs/contexts_manager.lua:99: Context unregister:LIVEUPDATE_COLLECTION
ERROR:RESOURCE: Leaked resources:
ERROR:RESOURCE: Resource: /leaked buffer5.bufferc  ref count: 1
ERROR:RESOURCE: Resource: /leaked buffer4.bufferc  ref count: 1
ERROR:RESOURCE: Resource: /leaked buffer3.bufferc  ref count: 1
ERROR:RESOURCE: Resource: /leaked buffer2.bufferc  ref count: 1
ERROR:RESOURCE: Resource: /leaked buffer1.bufferc  ref count: 1
INFO:DLIB: SSDP: Done on address 192.168.0.102
INFO:DLIB: SSDP: Done on address 192.168.56.1
2 Likes

Got a fix for this, a new beta is building

2 Likes

The bug has been fixed; it is now building.

2 Likes

Updated beta is available now

I have tested it now and the new dimensions match correctly. I noticed two things:

  1. It doesn’t work properly when Allow Dynamic Transforms is set to true in game.project. When that flag is true, changing the diameter of a sphere doesn’t do anything. Resizing a box works but it resets to pos=(0,0,0) even if another position is set in the editor. Maybe it is not supposed to work with that setting on and in that case you can disregard this.
  2. I get a crash:
    Assertion failed: area > 1.192092896e-07F, file ..\src\box2d\Box2D\Collision\Shapes\b2PolygonShape.cpp, line 361 when exiting the application after setting the width or height to zero. I guess this is not a problem since setting the dimensions to zero doesn’t make much sense.
1 Like

Yes, I think it’s not comparable with Allow Dynamic Transforms option.

It’s not critical, because this value isn’t valid. We will add a Lua error for it, but maybe in the next version

2 Likes

if @d954mas is happy with the fix, then I think we’ll happy too, and will continue with the stable release?

3 Likes

I am happy) :grin:
All errors fixed. Worked stable)
:partying_face: :+1: :+1: :+1:

6 Likes

Thanks!

1 Like

:relaxed: Hello how are you?
I just resumed my internship with Defold after a while, however I noticed that they started asking me for an update every time I open the editor, is this normal? :thinking:

PS. I use KDENeon as OS, I did a hard reset to my pc. :penguin:

I apologize in advance if this was not the topic to express my doubts. :wink:


Screenshot_20240212_111910

Could you please share an editor log?

Also, which version of Defold are you using?

Updated to 1.6.4 :astonished:

:face_with_monocle: Britzl, I read the information you suggest me , thank you for your prompt help.
P.S. Version 1.6.4 was released a few minutes ago. :nerd_face:

I think we will fix both in the next version

1 Like