Cache size limits
The maximum theoretical cache size is 2 GB.
The size of cache you can specify is limited by the amount of physical memory and paging space available to the system.
The shared class cache consists of memory mapped files that are created on disk and remain when the operating system is restarted. If you change the default behavior by using the -Xshareclasses:nonpersistent option, so that the cache is not retained on restart, the cache for sharing classes is allocated by using the System V IPC shared memory mechanism. In this case, on Linux® only, cache size is limited by SHMMAX settings, which limits the amount of shared memory that can be allocated.
You can find these settings by looking at the/proc/sys/kernel/shmmax file. SHMMAX is typically set to 30 MB.
Because the virtual address space of a process is shared between the shared classes cache and the Java™ heap, if you increase the maximum size of the Java heap you might reduce the size of the shared classes cache you can create.