Skip to content

problem about "ZGC" #26

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

Closed
Noogear opened this issue Jul 25, 2024 · 3 comments
Closed

problem about "ZGC" #26

Noogear opened this issue Jul 25, 2024 · 3 comments

Comments

@Noogear
Copy link

Noogear commented Jul 25, 2024

ZGC employs a technique known as colored pointers. The idea is to use some free bits in 64-bit pointers into the heap for embedded metadata. However, when dereferencing such pointers, these bits need to be masked, which implies some extra work for the JVM.
To avoid the overhead of masking pointers, ZGC involves multi-mapping technique. Multi-mapping is when multiple ranges of virtual memory are mapped to the same range of physical memory.
ZGC uses 3 views of Java heap ("marked0", "marked1", "remapped"), i.e. 3 different "colors" of heap pointers and 3 virtual memory mappings for the same heap.

FROM: https://stackoverflow.com/questions/62926652/the-java-zgc-garbage-collector-uses-a-lot-of-memory

-XX:+UseZGC -XX:AllocatePrefetchStyle=1 -XX:-ZProactive
In my tests, it does take up three times as much

-XX:+UseZGC -XX:AllocatePrefetchStyle=1 -XX:+ZGenerational
However, when I use this ZGC parameter, it doesn't result in triple occupancy, but it does prompt me at the beginning:
[0.001s][warning][gc,jvmci] Setting EnableJVMCI to false as selected GC does not support JVMCI: z gc
What are the consequences of this?

@Noogear
Copy link
Author

Noogear commented Jul 25, 2024

i have found the answer.
oracle/graal#2149

@Noogear Noogear closed this as completed Jul 25, 2024
@Noogear
Copy link
Author

Noogear commented Jul 26, 2024

I think it can be marked that ZGC will cause three times the memory usage, and the new-generation ZGC is incompatible with Graal. @Mukul1127

@Noogear Noogear reopened this Jul 26, 2024
@Noogear Noogear closed this as completed Jul 26, 2024
@Mukul1127
Copy link
Owner

Using the new ZGC on GraalVM technically works though it disables a major optimization, I'll add a note.

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

2 participants