Shopkeepers

Shopkeepers

2M Downloads

Shopkeepers not working after restart/Memory Leak

blablubbabcDEV opened this issue ยท 8 comments

commented

Migrated from: https://dev.bukkit.org/projects/shopkeepers/issues/163

Originally posted by czaarek99 (Jul 19, 2013):

What steps will reproduce the problem?

  1. Make a shopkeeper with some items
  2. Restart/reload the server
    3.What is the expected output? What do you see instead?
    I should just get the plugin villagers that work.
    Instead I get moving villagers and I cant trade with them.What version of the product are you using?
    v 1.14.2Do you have an error log of what happened?
    There are no erros.Please provide any additional information below.
    Im using this on 1.6.2.
commented

Originally commented by czaarek99 (Jul 19, 2013):

My dev also stated that this plugin causes a memory leak:
http://pastebin.com/DNcZRrr0

commented

Originally commented by nisovin (Jul 19, 2013):

Are you getting a console error? Do you get a save.yml file? Is the plugin even loading?
As for the memory leak, when a chunk unloads, I remove any shopkeeper entities in the chunk and null the references.
As for saving, I recommend you set save-instantly to false in your config. It reduces saving to occur once every 5 minutes, rather than every time there's a change in a shopkeeper's data.

        Edited Jul 19, 2013
commented

Originally commented by nisovin (Jul 19, 2013):

I've realized I was, in fact, keeping a reference to the entity by accident. Whether that was actually holding the chunk in memory, I don't know. But you're welcome to try the newest version (which is actually designed for 1.6.2):
http://dev.bukkit.org/bukkit-plugins/shopkeepers/files/37-v1-15-1/

commented

Originally commented by czaarek99 (Jul 20, 2013):

Now only like 3 villager spawn in, but they all work. This is even more strange.

commented

Originally closed by nisovin (Jul 25, 2013)

commented

Originally commented by czaarek99 (Jul 20, 2013):

Ok. I got this to work. I just re-made all my villagers and they are fine. But also /shopkeeper creeper only creates a normal villger?
My dev also stated this:
[15:26:02] Juho: yes
[15:29:51] Juho: he is basically keeping a List<> of all shopkeepers in a chunk
[15:30:07] Juho: which he then stores in a Map<> with the key set to the chunks coordinates
[15:30:19] Juho: so you have 300 extra objects
[15:30:31] Juho: which all need to be garbage collectted

        Edited Jul 20, 2013
commented

Originally commented by nisovin (Jul 20, 2013):

@czaarek99:
Those are not "extra" objects and do not need to be garbage collected unless the plugin is reloaded or disabled. That map stays fairly static and is used to determine which villagers need to be spawned or despawned as chunks are loaded and unloaded. Those objects are not leaking, the same references are always maintained while the plugin is running. I feel like he seems to think that the Shopkeeper object is an entity in the world, but it isn't.

commented

Originally commented by czaarek99 (Jul 20, 2013):

My dev will post here, hes currently sleeping...
Edit: Also what about the creeper shops?

        Edited Jul 20, 2013