Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

JAVA Memory overflow solution

Smartcard solutions

Moderator: product

lanzi
Posts: 39
Joined: Fri Sep 28, 2018 3:41 am
Points :200
Contact:

JAVA Memory overflow solution

Post by lanzi » Mon Jan 14, 2019 2:20 am

1、Question:
Log in Java. Lang. OutOfMemoryError: Java heap space.

2、Problem analysis
Java. Lang. OutOfMemoryError: Java heap spaceHeap set the JVM heap size setting refers to the Java program is running process used to reach the JVM can allocate memory Settings. The JVM heap size is automatically assigned at start-up time value, its initial space (Xms) is 1/64 of the physical memory, the largest space (-xmx) is a quarter of physical memory. You can set it using the -xmn-xms-xmx and other options provided by the JVM. Heap size is the sum of Young Generation and Tenured Generaion. Tip: in the JVM this exception is thrown if 98% of the time is spent in GC and the Heap size available is less than 2%. Tip: the Heap Size should not exceed 80% of the available physical memory. In general, set the -xms and -xmx options to the same value, while the -xmn is 1/4 of the -xmx value. JAVA_OPTS = "- server - Xms128M - Xmx256Mjava. Lang. OutOfMemoryError: The full name of PermGen space is Permanent Generation space, which refers to the Permanent storage area of memory. This memory is mainly used to store Class and Meta information by JVM, and the Class will be put into PermGen space when it is loaded. Unlike the Instance Heap area,GC(Garbage Collection) does not clean PermGen space at runtime, so if you have a lot of classes in your application, you are more likely to get PermGen space errors, which are common when web servers precompile JSPS. This error message is generated if your WEB APP USES a large number of third-party jars that are larger than the JVM's default size (4M). JAVA_OPTS = "- server - XX: PermSize = 64 m - XX: MaxPermSize = 128 m

lanzi
Posts: 39
Joined: Fri Sep 28, 2018 3:41 am
Points :200
Contact:

Re: JAVA Memory overflow solution

Post by lanzi » Mon Jan 14, 2019 2:21 am

3、Basic knowledge of JVM heap memory
The JVM Heap memory is divided into two blocks: Permanent Space and Heap Space. Permanent, the Permanent Generation, mainly stores Java class definition information and has little to do with the Java objects the garbage collector is collecting. Heap = {Old + NEW = {Eden, from, to}}, Old is Old Generation, NEW is Young Generation. The division of older and younger generations has a greater impact on garbage collection. < IMG SRC = "file:///C:\Users\Administrator\AppData\Roaming\feiq\RichOle\657504060.bmp" > 4, memory analysis Tool Jconsole. ExeMemory Analyzer Tool (MAT) 5, solution - XX: CMSInitiatingOccupancyFraction when filled with, The parallel collector then begins garbage collection, for example, when there is not enough space to hold newly allocated or promoted objects. With a CMS collector, long waits are undesirable because the application is running continuously (and allocating objects) during concurrent garbage collection. Therefore, in order to complete the garbage collection cycle before the application runs out of memory, the CMS collector starts earlier than the parallel collector. Because different applications have different object allocation patterns, the JVM collects the actual runtime data for object allocation (and release) and analyzes it to determine when a CMS garbage collection cycle should be initiated. To guide this process, the JVM looks for clues before executing the CMS cycle in the first place. The clues by - XX: CMSInitiatingOccupancyFraction = < value > to set, this value represents the old s heap usage. For example, value=75 means that the first CMS garbage collection is triggered when 75% of the old generation is occupied. Usually CMSInitiatingOccupancyFraction the default value is 68 (previously experienced for a long time to decide).

lanzi
Posts: 39
Joined: Fri Sep 28, 2018 3:41 am
Points :200
Contact:

Re: JAVA Memory overflow solution

Post by lanzi » Mon Jan 14, 2019 2:22 am

Solution:
- XX: CMSInitiatingOccupancyFraction

When heaped, the parallel collector begins garbage collection, for example, when there is not enough space to accommodate newly allocated or promoted objects. With a CMS collector, long waits are undesirable because the application is running continuously (and allocating objects) during concurrent garbage collection. Therefore, in order to complete the garbage collection cycle before the application runs out of memory, the CMS collector starts earlier than the parallel collector.

Because different applications have different object allocation patterns, the JVM collects the actual runtime data for object allocation (and release) and analyzes it to determine when a CMS garbage collection cycle should be initiated. To guide this process, the JVM looks for clues before executing the CMS cycle in the first place. The clues by - XX: CMSInitiatingOccupancyFraction = < value > to set, this value represents the old s heap usage. For example, value=75 means that the first CMS garbage collection is triggered when 75% of the old generation is occupied. Usually CMSInitiatingOccupancyFraction the default value is 68 (previously experienced for a long time to decide).

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 16 guests

JavaCard OS : Disclaimer