Skript: Duplicate Aliases Stored

Created on 28 Jul 2019  路  6Comments  路  Source: SkriptLang/Skript

Description


When running a Memory Analysis on my server, I found that Skript Aliases were taking up 49.6MB in 1.2M objects
image
image

Odd thing is that some aliases are duplicated many times
image
image
image

May not be a large bug, but seems inefficient to have 1.4k copies of trapdoors stored

Steps to Reproduce


Just run a server with Skript, and then dump the heap after it's done with loading

Server Information

  • Server version/platform: Spigot 1.14.4
  • Skript version: Skript 2.4-beta3

Additional Context


Used Eclipse Memory Analyser

enhancement medium

Most helpful comment

New release with my changes is out. Does it help with memory usage, @Wealthyturtle?

All 6 comments

Really strange that some of the trapdoors are storing more dupes than others too.

The aliases should be guarding against storing duplicate entries like this.

I investigated this, and found no obvious memory leaks. Still, I managed to optimize a bit.

Let's look at those duplicate Minecraft id strings first. JVM string deduplication should take care of most of the overhead, but not all of it. I've applied String.intern() on them, which might help a bit.

I've implemented deduplication, which removes most of unnecessary memory usage. Still, there are many aliases; they do consume quite a lot of memory.

New release with my changes is out. Does it help with memory usage, @Wealthyturtle?

@bensku will get back to you in 24 hours :)

image
image
Can confirm that it's been optimized! @bensku

By the way, please check out #2246 :/

Accidentally tagged this instead of #2396

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheClassic36 picture TheClassic36  路  3Comments

MrScopes picture MrScopes  路  3Comments

jaylawl picture jaylawl  路  3Comments

Anoniempje1234 picture Anoniempje1234  路  3Comments

Snow-Pyon picture Snow-Pyon  路  4Comments