Scoreboard memory leak

Discussion in 'Performance Tweaking' started by defineci00, Dec 10, 2016.

  1. [​IMG]

    Hi, I started using this feature a few weeks ago.

    Then BungeeCord's ram usage began to increase. As a result of some research (I used Yourkit & Jprofiller) I realized that this problem originated from the Health system.

    How do I use this Health feature without memory leak?

    Note: Scoreboard plugin in Spigot server.

    Scoreboard code;
    Code (Text):
            this.scoreboard = ScoreboardAPI.createScoreboard(DisplaySlot.SIDEBAR,
                                    new ScoreboardAPI.ScoreboardEntry("serverinfo", "§d§l" + "▶" + " Server Info", ""),
                                    new ScoreboardAPI.ScoreboardEntry("arenano", "§fArena No: §e", factory.getScoreboardInfo().replace("%arena%", arena.getID() + "")),
                                    new ScoreboardAPI.ScoreboardEntry("date", "§fDate: §e", ""));
            ScoreboardAPI.setDisplayNameTime(scoreboard, factory.getWaitingStartTime());
            Objective healthBar = scoreboard.registerNewObjective("showHealth", "health");
            healthBar.setDisplayName("§c" + "❤");
    #1 defineci00, Dec 10, 2016
    Last edited: Dec 10, 2016
  2. It is normal that it consumes a lot of memory, it must be updating the health of all the players constantly and then sending it to the scoreboard
  3. 6 GB for 1500 player, is it normal ?
  4. You have 6GB or the scoreboard consume 6GB
  5. Yes, this feature used 1-2 gb of bungeecord before.
    When I run System.gc () it drops down but the server freezes for 4-5 seconds when I run this.
  6. Call to System.gc () usually consume 1-1.5Gb, if you found other plugin with those functions and that you do not use that process you could change it.
  7. You could make it check now and then instead of constantly
  8. Tux


    You can try using Waterfall, which optimizes this usecase specifically.
  9. electronicboy

    IRC Staff

    If you allocate 6GB, Java will use 6GB. That's how memory usage in java works, calling System.gc is also bad, as it tells the JVM to do a forceful sweep of the memory, which is what causes the pause, which frees memory because it removes objects which are no longer in use.
    GC knows how to do a better job than you so long as you let it work properly, and throwing a ton of memory at java does not let it work properly.

    I have doubts that this is an instance of an issue with bungee as much as it's an issue with your understanding of how memory in Java actually works. allocating 6G of ram to Bungee is a bit over the top.
    • Like Like x 1

Share This Page