Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memery leak with cyclic preload in GDScript #15839

Closed
Geequlim opened this issue Jan 18, 2018 · 4 comments
Closed

Memery leak with cyclic preload in GDScript #15839

Geequlim opened this issue Jan 18, 2018 · 4 comments
Labels

Comments

@Geequlim
Copy link
Contributor

Godot version: Godot 3.0 RC1

Issue description:

Memery leak with cyclic preload in GDScript.

Steps to reproduce:

Create a script a.gd with content as below

extends SceneTree

const b = preload("b.gd")
func _init():
	quit()

Create another script b.gd with content as below

const a = preload("a.gd")

Run the script a.gd with godot

godot -s a.gd

The program complains about memery leaks

ERROR: ~List: Condition ' _first != __null ' is true.
   At: core/self_list.h:100.
ERROR: ~List: Condition ' _first != __null ' is true.
   At: core/self_list.h:100.
WARNING: cleanup: ObjectDB Instances still exist!
   At: core/object.cpp:1989.
ERROR: clear: Resources Still in use at Exit!
   At: core/resource.cpp:418.
@reduz
Copy link
Member

reduz commented Jan 18, 2018

This is not a bug, this is a feature. It's in the GDScript documentation. Any cycles are leaked.

@reduz reduz closed this as completed Jan 18, 2018
@Geequlim
Copy link
Contributor Author

So how to use this feature in right way?
I can't write as weakref(preload('b.gd')

@sersoong
Copy link
Contributor

What?Is it a feature?How to use it.

@reduz
Copy link
Member

reduz commented Jan 18, 2018

@Geequlim you cant, simply dont do cycles. Just dont use preload, use load() normally and then you can weakref.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants