System and method for solving memory leak in proxy mode
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 贵阳语玩科技有限公司
- Publication Date
- 2019-11-15
Smart Images

Figure 1 
Figure 2
Abstract
Description
technical field
[0001] The invention relates to the technical field of Java, in particular to a system and a method for solving memory leaks by using a proxy mode. Background technique
[0002] In Java, non-static inner classes can cause memory leaks. The general solution is to change non-static inner classes to static inner classes. But this solution will reduce the convenience of writing code. In development, it is often necessary to write an anonymous inner class, which is a kind of non-static inner class. If you want to change the anonymous inner class to a static inner class, you can write code. inconvenient.
[0003] Such as figure 1 As shown, objectA is a leaked memory object, its type is OuterClass, which represents the outer class, and InnnerClass is its non-static inner class; Refer to the objectA object; just this will not cause memory leaks. The most important thing is that objectB is strongly referenced by an object objectC with a longer life cycle. When the ...