2015 Sohu Online pen test (memory leak problem) (GO)

Source: Internet
Author: User

In the following operations, the possible means to resolve the Java memory leak problem are: "Multiple selection" ()

  1. Call System.GC () in the program;
  2. Turn off network/database connections that are no longer in use;
  3. Call Finalize () in the program;
  4. Cleans up useless objects in the collection class;
  5. Call Runtime.getruntime () in the program. Runfinalization ();

The answer should be BD
The first memory leak is due to the fact that some useless objects cannot be reclaimed, and the condition of object recycling is based on
Search is not up to the algorithm, then what can be used as the root?
1. Objects referenced by class static variables in the method area
2. Objects referenced in the virtual machine stack frame
3. Objects referenced in the local method stack frame
4. Objects referenced by constants in the method area
Objects that are unreachable from these roots are objects to be recycled, and the answer is that both A and e are JVMs.
Garbage collection does not fundamentally address memory leaks, and the answer c is only in garbage collection
Before doing something (and not guaranteed to be done).

Which of the following conditions causes the persistence zone JVM heap memory to overflow ()

  1. Looping tens of thousands of string processing
  2. Apply hundreds of M or even g of memory within a piece of code
  3. Direct manipulation of bytecode operation using cglib technology, generating a large number of dynamic classes
  4. Constantly creating objects

Permanent: Durable generation (method area)

Loading class information, constants, static variables, the compiler compiled code, such as the basic data, the default 64M, if the class is a lot of service programs, need to increase its settings-xx:maxpermsize=, otherwise it will be full after the FULLGC () or out of Memory. Note that spring,hibernate-like frameworks that prefer AOP to dynamically generate classes require more persistent memory. In general, a durable generation is not GC-only, unless forced by-xx:+cmsclassunloadingenabled-xx:+cmspermgensweepingenabled.

2015 Sohu Online pen test (memory leak problem) (GO)

Related Article

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.