packetevents icon indicating copy to clipboard operation
packetevents copied to clipboard

Opt to not load the `WrappedBlockState`s

Open imkunet opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

Due to the nature of being on a 1.8 server with zero budget, heap space is gold.

image

For my purposes (which I'd imagine many relate to) this heap space is wasted space.

Describe the solution you'd like

Allow for not loading the WrappedBlockStates when using the SpigotPacketEventsBuilder. image

Kind of like this, but not awful.

Describe alternatives you've considered to solve your solution without us adding this as a feature?

  • [x] Copy paste the class and just comment it out (hacky)
  • [ ] Buy better servers (no money)
  • [ ] Instrument the class at runtime (why would you do this)
  • [ ] Use reflection to empty the maps (...no)
  • [ ] Use sun.misc.Unsafe to free the memory (technically unsafe, as the name implies)
  • [ ] Coerce the memory into loading into specific pages, then forcibly put into swap (degrades gc performance)

imkunet avatar Aug 15 '24 12:08 imkunet

you never know if WrappedBlockStates will be needed or not. It would be a shading-only feature.

rafi67000 avatar Aug 15 '24 13:08 rafi67000

Maybe provide the functionality to customize it for plugins that shades PacketEvents? For example adding an option called MappingExemptStrategy with ALL, CURRENT_VERSION, NONE, and load the mappings that matches the strategy etc etc.

LeeGodSRC avatar Aug 15 '24 13:08 LeeGodSRC

I would be more in favor of a system property or just reverting back to lazy-loading the mappings. On spigot/paper everything except the server version isn't used anyway, as far as I know.

booky10 avatar Aug 17 '24 14:08 booky10