- Edited
As I understand, when you use yield
or await
, a coroutine is created that will execute some code when some conditions are met. In the case of await
, the coroutine runs when a certain object emits a certain signal. I wonder what happens to coroutines when the object it's waiting the signal from is destroyed.
example:
var newThing = thing.instantiate()
add_child(newThing)
await newThing.countToTen
print("thing counted to ten)
What happens to the coroutine waiting to print
if the newThing
is freed before it emits "countToTen"? Will it just accumulate in memory and cause a memory leak?