Use the -XX:MaxMetaspaceSize option. Frame the concept in practical terms so you can explain it during interview discussion.
To prevent Metaspace from consuming too much native memory, you can set a maximum size using the -XX:MaxMetaspaceSize option. This is useful in large applications to maintain control over memory usage. For example, setting -XX:MaxMetaspaceSize=512m limits Metaspace to 512 MB.
Additional Notes
What JVM option is used to set the maximum Metaspace size?