Replies: 1 comment
-
Guis are just like any other objects in Java - if they're no longer used anymore, they will be removed by the garbage collector. How the garbage collector works and when exactly it removes the reference depends on many factors, so if you want to know the specifics regarding this, I'd recommend looking up some articles regarding garbage collection in Java. As to whether storing and reusing guis or creating them again is better, this depends. Storing them will take up more memory, but will probably save some time. Whereas recreating them each time saves you some memory, but will take more time to create them from scratch. The overheads of either approach are probably insignificant, though, so unless you have compelling evidence suggesting one approach is much better, I'd just stick with whatever you prefer. |
Beta Was this translation helpful? Give feedback.
-
I'm using your framework to write a plugin which lets players change the NBT values of an entity using a nice GUI. In my current implementation, a new GUI is created every time a NBT value gets changed in the GUI. So when a player quickly changes a value, many GUIs will be created, which aren't used anymore after a newer GUI is created.
I was wondering if I should store the needed GUIs for every player, so that I can reuse them and don't have to create new GUIs. Or is it unproblematic to create many GUIs? I would guess that GUIs are automatically deleted from memory if they aren't used anymore, but I wasn't able to find information about this in the wiki.
Beta Was this translation helpful? Give feedback.
All reactions