Potential memory leak on world unload and adapter object doubling
Kryniowesegryderiusz opened this issue ยท 2 comments
Server Implementation
Paper
Server Version
1.19.3
Describe the bug
Creating and deleting worlds seem to have memory leak, while using FAWE.
Also, for some strange reason adapter is created for two different versions.
I'm creating plugin that creates world, pastes schematic and after some time it deletes that world.
I've found this thread on PaperMC github, its similar issue redirected to FAWE, but I havent found any follow up here. PaperMC/Paper#9199
Two heapdumps with this issue are here: https://skyup.pl/public/heapdumps/
One of them is smaller, but still show many worlds.
To Reproduce
The only API I'm using from FAWE is this:
// Create session with world adapting
EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(world));
// Loading schematic
String schematicName = "..." // some schematic name
File file = new File(Main.getInstance().getDataFolder(), "/schematics/"+schematicName);
ClipboardFormat format = ClipboardFormats.findByFile(file);
ClipboardReader reader = format.getReader(new FileInputStream(file));
Clipboard clipboard = reader.read();
ClipboardHolder clipboard = new ClipboardHolder(clipboard);
// Transforming schematic
double dt = //some transformation
clipboard.setTransform(new AffineTransform().rotateY(dt));
//Pasting schematic
Operations.complete(clipboard.createPaste(editSession)
.to(BlockVector3.at(x, Main.getSettings().getDungeonY(), z))
.ignoreAirBlocks(true)
.build());
//Closing session
editSession.close();
Expected behaviour
To not have memory leak
Screenshots / Videos
MAT schows 17 WorldServer objects loaded, but most of them are already deleted worlds.
I'm not using any regeneration.
Error log (if applicable)
No response
Fawe Debugpaste
https://athion.net/ISPaster/paste/view/73d68e815ca944d39e098438a0e1185b
Fawe Version
FastAsyncWorldEdit version 2.6.3-SNAPSHOT-468;152d870
Checklist
- I have included a Fawe debugpaste.
- I am using the newest build from https://ci.athion.net/job/FastAsyncWorldEdit/ and the issue still persists.
Anything else?
No response
That is hard to reproduce with 73 other plugins, purpur instead of paper in 1.19.3 (newest is 1.19.4) and this kind of issue with your plugin:
[21:07:06] [Server thread/INFO]: Could not set generator for world 'dungeon_325_egzekucja_': Plugin '2;0;1;' does not exist
Can you test only with FAWE and redo it with your plugin with the mentioned api?