languages (Java, C #, and the Old Lisp mentioned earlier), the main criterion is to determine whether an object survives by means of the reachability analysis.Algorithm basic idea: through a series of objects called "GC Roots" as the starting point, starting from these nodes to search down, the path of the search is called the reference chain (Reference Chain), when an object to the GC Roots no reference chain connected (in the case of mathematical g
, the conclusion is that the simpler the constructor, the better, do not do too much in the constructor function. Go back and look at Zajia's previous article:Android itself defines UI traps: Layoutinflater.from (). Inflate () must not work in the parent class or virtual class assuming that the Initview () is placed in the parent class, the subclass Layout_ The ID is also 0 when it is used. So even if you want to use it, make it into a static type.This article is about writing high-quality code:
Insider Analysis on Java object size
In a recent whim, I suddenly became interested in the memory size of Java objects. I collected some information on the Internet and sorted it out. I hope you can help me.If: you can calculate the memory size occupied by the new String ("abc") object in the JVM (64-bit JDK7 compressed size of 48 B, not compressed size of 64 B )
Java and PHP Comparative analysis in web development
This article mainly from 8 aspects of PHP and Java in the Web development of the pros and cons of the analysis and comparison, very good article, it is recommended to small partners.
Compare PHP and JSP two Web development technology, in the current situation is act
: communication Protocol (SOCKET/TCP/HTTP/UDP/RMI/XML-RPC etc), message mechanism, network IO (Bio/nio/aio), multithread, Transparent scheme for local invocation and remote invocation (involving Java Classloader, Dynamic Proxy, Unit Test etc), asynchronous and synchronous calls, network communication processing mechanism (auto-re-connect, broadcast, exception, pool processing, etc.), Java Serialization (pri
tree, or red-black tree.1. RelationshipTreeSet uses treemap in the adorner mode, they both implement the same interface Navigablemap, and in TreeSet, they hold the navigablemap reference, in fact the TreeSet will be treemap when it is constructed.public class TreesetThen look at the list structure in the TREEMAP definition, Entry, which left and right respectively for the child and the child.Static Final class Entry2. The sort implementation sort is only for key (set is only using the key of th
JVM will throw java if no more memory can be allocated to new objects. lang. outofmemoryerror: Your program will be replaced. Before throwing an OutOfMemoryError, JVM will try to use the Garbage Collector to free up enough space, but this error will be thrown when it finds that there is still not enough space. To solve this problem, you need to know the information of your program objects, such as the objects you have created and the space occupied b
Characteristics and analysis of Java languageJava is an object-oriented programming language.(the Java language, represented as a static object-oriented programming language, implements an object-oriented theory that allows programmers to do complex programming in an elegant way of thinking.) )Java has the characterist
. Mat is a graphical interface tool, with Windows version, more convenient. But the mat has a dead hole, and when the parsed hprof file is too large, a memory overflow error occurs, resulting in a failure to get results. I've tried to solve this problem,However, no effective method has been found. So here I'm using Jhat. Jhat Analysis Heap Dump snapshot jhat is a Java-brought command-line tool that is relat
obtained by Javap-verbose TestClass, as follows:As we can see clearly, the constant pool in TestClass has 24 constants, and don't forget the No. 0 constant, because the No. 0 constant is used to indicate that the data item in class does not reference constants in any constant pool. From the above analysis we learned that TestClass's first constant representation method, where Class_index points to the fourth constant is
"); }}classSonextendsFather {Static{System.out.println ("Init son"); }} Public classDemo { Public Static voidMain (string[] args) {System.out.println (SON.A);//initializes only the parent class FatherSon.method (); }}Console results:init father1Father method5. Call the LoadClass () method of the ClassLoader class to load a class that simply loads the class, not the active use of the class, and does not cause the initialization of the class. Using the Class.forName () static method causes the cla
A brief analysis of new,this,super,final keywords in Java
New Keyword
For example people person=new people ();
create an object what does it do in memory? load the People.class file at the specified location on the hard disk into memory first. When executing the main method, the Main method's space (stack-stack) is opened in stack memory, and a variable person is assigned to the stack area of the main met
This article consists ofimportnew - lomoxy translated from javapapers. Directory
Introduction to Garbage collection
How does garbage collection work?
Categories of garbage collection
Garbage collection Monitoring and analysis
In this Java GC Series tutorial, let's learn about tools for garbage collection monitoring and analysis. Then, ch
Compared with static code analysis, profiling is a dynamic analysis method for studying program behavior by collecting information during program running. The purpose is to locate the part of the program that needs to be optimized to improve the program running speed or memory usage efficiency. The following three methods are used to collect information when a program is running:
Event method: for
In a distributed service framework, 一个最基础的问题就是远程服务是怎么通讯的,在Java领域中有很多可实现远程通讯的技术 such as RMI, MINA, ESB, Burlap, Hessian, SOAP, EJB, and JMS, what is the relationship between these nouns, and what is the rationale behind them? Understanding these is the basic knowledge of implementing a distributed service framework, and if there is a high performance requirement, then it is necessary to understand the mechanics behind these technologies.1 FundamentalsI
: communication Protocol (SOCKET/TCP/HTTP/UDP/RMI/XML-RPC etc), message mechanism, network IO (Bio/nio/aio), multithread, Transparent scheme for local invocation and remote invocation (involving Java Classloader, Dynamic Proxy, Unit Test etc), asynchronous and synchronous calls, network communication processing mechanism (auto-re-connect, broadcast, exception, pool processing, etc.), Java Serialization (pri
amount of compilation time to achieve most of the efficiency gains, but also because of the implementation process of monitoring at all times, the internal code and other optimization has played a big role. Because of the object-oriented polymorphism, a method may correspond to many different implementations, and adaptive optimization can greatly reduce the size of the inline function by monitoring only those code used in the inline.
The Sun JDK is compiled with two modes: client and
with memory space but cannot be accessed. Because c ++ does not have GC, these memories will never be recovered. In Java, GC is responsible for the collection of these inaccessible objects, so programmers do not need to consider the memory leakage.
Through analysis, we know that for C ++, programmers need to manage edges and vertices themselves, while Java progr
during the compilation period until it reaches the runtime)
Because the list
Reflection mechanism, through the check during the compilation period cheated us. In addition, we can pass the compiler check through reflection.
Implementation Code
Package COM. jue. test; import Java. lang. reflect. invocationtargetexception; import Java. lang. reflect. method; import
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.