HungryProton / scatter

Godot engine addon to randomly fill an area with props or other scenes
MIT License
2.08k stars 94 forks source link

Memory leak and crash #164

Open wladi0097 opened 1 year ago

wladi0097 commented 1 year ago

This is a very weird bug that is not available when I remove the scatters from the scenes. This bug is not reproducible on all machines I tested on except one, it is listed under "System".

Reproduction:

  1. Fill two scenes with the default tree scatter
  2. load a new scene with get_tree().change_scene_to_file("res://worlds/test.tscn")
  3. load a second new scene with get_tree().change_scene_to_file("res://worlds/otherTest.tscn")
  4. repeat steps 1-2 until the game crashes. Used memory went up every time by 500 MB.

My Guess: scatter is never really freed but kept in memory and therefore the parent scene is never really freed and is keeping a "device" entity. The crash happens when Vulkan cannot assign more "devices" than provided by the operating system and therefore dies. I do not think the issue is because of the memory going up every newly loaded scene.

Crash Log:

ERROR: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message
        terminator_CreateDevice: Failed in ICD C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_d3828c822366e497\.\nvoglv64.dll vkCreateDevice call
        Objects - 1
                Object[0] - VK_OBJECT_TYPE_INSTAhNtCeEr,r aHiann.dglde:  1U6p9d3a0t0i8n9g1 9t4e0r8r

System: OS: Microsoft Windows 10 Pro GPU: RTX 2080 Ti -> Nvidia driver latest (eg 537.42) CPU: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz, 3600 Mhz, 8 Core(s), 8 Logical Processor(s) RAM: 32GB DDR4

HungryProton commented 1 year ago

Thanks for the report, I will try to replicate it on my end, hoping it's not a driver issue (I have an AMD graphic card)