Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses too much memory #565

Closed
ChicknTurtle opened this issue Jun 29, 2024 · 6 comments
Closed

Uses too much memory #565

ChicknTurtle opened this issue Jun 29, 2024 · 6 comments

Comments

@ChicknTurtle
Copy link

I am hosting a server locally on my mac, and bluemap is always using more memory than my server (5gb) even when nobody is on the server or viewing the map.

My pc has 16gb of memory, but while running other things like my minecraft client, web browser, etc, it maxes out my memory and causes the server to lag.
So, I think there should be an option to cap the memory to whatever amount. Also, the map should not do anything while nobody is viewing the map.
I might disable bluemap until something like this is added

BlueMap Version: BlueMap-3.21-spigot.jar

@SjoerdHekking
Copy link

You can limit the maximum amount of memory allocated to BlueMap by setting JVM options. This can be done by editing the startup script or command used to run BlueMap. Add the -Xmx flag to specify the maximum heap size.

@ChicknTurtle
Copy link
Author

ty!

@ChicknTurtle
Copy link
Author

Where do I add the JVM arguments? I've looked through all config files for bluemap. I don't want to set max memory for the whole server, just the bluemap process.

@ChicknTurtle ChicknTurtle reopened this Jun 29, 2024
@SjoerdHekking
Copy link

I wonder what model Mac you have (CPU core count etc.). If you wish to configure BlueMap in such a way it uses less performance from your mac, while you are also using it, you can tweak it via tips in this section . As for running the whole time, BlueMap updates whenever a world has been saved, I am not sure how often you save a world.

@ChicknTurtle
Copy link
Author

Model Name: Mac mini
Model Identifier: Macmini9,1
Chip: Apple M1
Total Number of Cores: 8 (4 performance and 4 efficiency)
Memory: 16 GB

I have the render threads set to 1, but that is for cpu. I am more worried about the memory usage.

@TBlueF
Copy link
Member

TBlueF commented Jun 29, 2024

@ChicknTurtle Alright, so:
It's not possible to "limit" the RAM BlueMap uses separately to the rest of the server, that's not how Java-Heap works ^^
Also, did you do a Heap-Dump or how do you even know that bluemap is using more RAM than the server if it is running as a plugin on said server? ^^

To clear up a few things:

  • Java reserves a specific amount of RAM for its Heap-Space. E.g. if you use -Xmx6G on your server Java will reserve up to 6GiB of RAM for heap-space and will usually not free this again during runtime. You should always only allocate as much RAM to your server as you can spare and expect this to always be used completely.
  • BlueMap does run completely fine with very limited amounts of heap
  • BlueMap does not hard-reserve huge amounts of ram while rendering and especially not when idle
  • BlueMap 5.2 does keep a soft memory cache for chunks it loaded to optimize rendering speed. However this is a SOFT allocation, meaning that if the JVM ever is in need of more Heap, Javas GarbageCollector will clear up that cache automatically and reuse it for things that are more important. -> BlueMap only uses Heap-Space for caching chunks that is NOT needed by anything else.
  • Unused heap-space is wasted heap-space.
  • If your server lags it is most likely not due to bluemap using too much ram/heap.

If you still think bluemap is using up too much ram/heap and it's not the soft-cache but actually hard memory-allocation that prevents the server from getting its own share of ram, then please attach a HeapDump for me to analyze, or a link to where i can download it. Otherwise please close this issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants