In the following operations, the possible means to resolve the Java memory leak problem are: "Multiple selection" ()
- Call System.GC () in the program;
- Turn off network/database connections that are no longer in use;
- Call Finalize () in the program;
- Cleans up useless objects in the collection class;
- 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 ()
- Looping tens of thousands of string processing
- Apply hundreds of M or even g of memory within a piece of code
- Direct manipulation of bytecode operation using cglib technology, generating a large number of dynamic classes
- 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)