in Education by
What is meant by a memory leak in Java, and how to implement it. Select the correct answer from above options

1 Answer

0 votes
by
What is meant by Memory Leak? The memory leak is a condition in which the program continues to hold on to the allocated memory even after the program no longer needs it and it just lies there i.e. inaccessible but still stored in the memory. Now, you can get memory leaks for java by manual memory management via JNI and thus have memory leaks, or by having bugs in JVM may also lead to memory leak. Now, there can be many ways in which you may achieve memory leak ( from two ways listed above), few of them are :- Field holding object reference class Darthvader { static final ArrayList arraylist = new ArrayList(100); } 2. Unclosed connections try { Connection connect = ConnectionFactory.getConnection(); … } catch (Exception s) { s.printStacktrace(); } 3.Open streams try { BufferedReader buffer = new BufferedReader(new FileReader(inputFile)); … } catch (Exception s) { s.printStacktrace(); }

Related questions

0 votes
    What is meant by a memory leak in Java, and how to implement it. Select the correct answer from above ... ,Core Questions, Core Hadoop MCQ,core interview questions for experienced...
asked Oct 31, 2021 in Education by JackTerrance
0 votes
    Which one of the following causes memory leak? (a) Release database connection when querying is complete (b) ... Miscellaneous of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 22, 2022 in Education by JackTerrance
0 votes
    I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    I have been doing Java development for a long time, but I am ashamed to say I still don't have ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I have an ETL requirement like: I need to fetch around 20000 records from a table and process each ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have been having some issues with LINQ-To-SQL around memory usage. I'm using it in a Windows ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    I have been having some issues with LINQ-To-SQL around memory usage. I'm using it in a Windows ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    I have been having some issues with LINQ-To-SQL around memory usage. I'm using it in a Windows ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 20, 2022 in Education by JackTerrance
0 votes
    Which of these class is used for creating a client for a server-client operations? (a) serverClientjava (b) ... Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    I am getting memory leak during migration using Realm (v1.0.2). My code looks like that: let ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I am writing some code that uses MPI and I was keeping noticing some memory leaks when running it with ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    We've tried jdk 1.7.0_02. Ten days of running give 420 MB memory leak of the following objects: ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    Which of the below is not a memory leak solution? (a) Code changes (b) JVM parameter tuning (c) ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which one of the following causes memory leak? (a) Release database connection when querying is complete (b ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
...