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

Add a way to remove scenes from cache? #7

Open
d-eisenga opened this issue Jun 20, 2022 · 7 comments
Open

Add a way to remove scenes from cache? #7

d-eisenga opened this issue Jun 20, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@d-eisenga
Copy link

I was looking at SceneLoader.gd, specifically the _get_cached_scene function, and it looks like scenes never get removed from the _scenes cache. It looks like the cache just going to grow and grow while the game runs, using ever more memory. Some way to remove scenes from the cache will probably be needed for larger games.

@workhorsy
Copy link
Member

I'll have to look into this more. I'm pretty sure that PackedScene is reference counted, and will get auto freed when there is nothing else using it.

@workhorsy workhorsy added the enhancement New feature or request label Jun 21, 2022
@d-eisenga
Copy link
Author

I'd assume if it's a value in a dictionary that would be considered a reference, but I admit I don't know much about Godot memory management.

@unicornlox
Copy link

Is this problem solved? Can you write if it is solved?

@workhorsy
Copy link
Member

workhorsy commented Jan 20, 2023

Hey @mrParabol . Unfortunately I ran into a design flaws with the current code. I'm working on a partial re write that should solve these problems. I've just been super busy with real world stuff. So I haven't had as much time to work on improving things. Hopefully I will have more time soon.

@unicornlox
Copy link

hello @workhorsy Thank you for your answer. I understand you. In fact, if you explain why the added scene is not deleted or stayed in Cache, I can continue my way. I delete the added scene from the stage tree, but when I switch to different stage, the scene I deleted is added again. I am making a game and I used your plug -in in my game, but I cannot release my game with this problem. I used this plug -in in many different places, and I can't go back. If you can give a clue to prevent my efforts from going to waste, I will be grateful to you.

@workhorsy
Copy link
Member

Hi @mrParabol . It sounds like you are talking about 2 different bugs. The cache only loads and stores a PackedScene. Those PackedScene resources are then cached. Instances of those PackedScenes are not cached. The instances are then added to the scene tree.

I think this may be a different bug. Can you show the code where you are using the plugin to add and remove to the scene tree?

Thanks

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

No branches or pull requests

3 participants