I am reviewing one java code base for finding some memory leaks. During the review I have find the following scenarios.
- A class Class1 has in the codebase. Class1 have some instance variables and some static members. Some other classes creating the instances of the Class1. Is this scenario leads to any memory leak?
- A class Class2 available in the codebase. It have some public static inner classes. And the instance of the static inner classes is creating from the other static inner classes. Does it lead to memory leak? For example,
Class2 { public static class Class3 { } public static class Class4 { } public static class Class3 { Class3 c = new Class3(); //…. } public static int doSomething1{ } public static void doSomething2{ } public void doSomething3{ } }
Can somebody give answers?