What does PermGenSize java flag do?

What does PermGenSize java flag do? I’ve used it for several of my Spigot Servers and Craftbukkit, but I’m not actually sure what it does. I’m wondering if it would be useful to add it to my FTB-Infinity Modpack Server, it currently has 6GB of RAM, and usually uses half of it at all times.

My personal recommendation is not to make any changes unless you know it to address an actual issue you’re experiencing.

PermGenSize is the space Java uses to hold what is essentially the “skeleton” or prototypes of object classes. Let’s say Spigot has a class called “block” (which it does). Every time it instantiates that class, to make a block that actually exists in the world, that memory is stored in the Java heap. But how does Java know what variables, methods, etc. are associated with the block each time without reading the file from disk? It keeps the class definition in the PermGen space.

Think of it like the actual source code for the class is kept in the PermGen space (even if it’s not literally the source code but instead compiled bytecode).

Because mods so often create many new classes and such, PermGen gets used a lot. However, unless you’re running into PermGen memory errors, it’s nothing you should be concerned about–and giving it additional space would go to waste.

That said, if you’re using java 1.8, PermGen is obsolete–Java in 1.8 dynamically resizes PermGen’s size.