If you are getting OOM errors after adding -XX:+UseLargePagesForCode in JVM arguments then you can try below steps to understand and resolve the issue.
Several out of memory errors are shown as below:
java.lang.OutOfMemoryError: CG #167161 (0) weblogic/ejb/container/deployer/EJBModule.unregisterBeanUpdateListeners()V in generate_code (compilerfrontend.c:537).
Java heap 4G reserved, 4G committed
Your Java heap size might be set too high.
Out Of Memory (OOM): An Out of Memory error occurs due to memory exhaustion, either in java heap or native memory. In the JVM, OOM errors are thrown when the JVM cannot allocate an object because it is out of heap memory, and no more heap memory could be made available by the garbage collector.
Memory Leak: A memory leak occurs if memory is used by an application and not released by the application when it is finished with it. A memory leak can occur in either java heap or native memory, and either will eventually cause an out of memory situation.
Check if the JVM is started with the argument -XX:+UseLargePagesForCode as with this the MaxCodeMemory might be set too low with the default value.
By default the option -XX:+ReserveCodeMemory is enabled on on Solaris SPARC, Windows x86_64, and Linux x86_64 platforms.
When -XX:+UseLargePagesForCode is set and also ReserveCodeMemory enabled then the MaxCodeMemory is limited to 64 MB.
Solution to above issue is:
Add parameter MaxCodeMemory to the JVM start arguments
Set <size> to 128m
Restart JVM and monitor
If still OOM errors are seen increase <size> further (e.g. 256m)
Repeat increasing MaxCodeMemory if necessary.