Remember a Java program memory overflow problem

Source: Internet
Author: User

A natural language handler that is deployed to the line after encapsulation is web-service.

But recently there has been a memory overflow situation, frequent out of memories.

First blindly try to add-xx:-usegcoverheadlimit to the startup script.

Because according to reason not found, still frequent out of memory, can only observe jstat-gcutil <pid>, see Laosheng generation memory drop down, restart the program.

The service program is simple, simple to receive parameters, natural language processing, return data, in addition to natural language processing module, are method parameters, there is no memory leak situation.

The first time to solve this memory overflow problem, there is no big clue. Always know that Java can dump memory, so try to analyze the memory with the mat.

When analyzing memory, look directly at the Dominator tree, and look at all instances of the root reference, and that instance memory usage is at a glance.

The cause of the memory overflow is found in this way:

There are 100,000 words of text sent by the service requestor, Natural language processing module creates a lot of variables, consumes a lot of memory, and the analysis of large text is slow, the memory occupied has not been released, resulting in the subsequent data processing can not obtain sufficient memory.

At this point, another large text, the service is hung up.

13333333333333~

Remember a Java program memory overflow problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.