More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. substring method would build a new String object keeping a reference to the whole char array, to avoid copying it. Hence you can inadvertently keep a reference to a very big character array with just a one character string.
Help us improve. Please let us know the company, where you were asked this question :
Ans. You need to capture heap dump when it's in the healthy state. Start your application. Let it take real traffic for 10 minutes. At this point, capture heap dump. Heap Dump is basically the snapshot of your memory. It contains all objects that are residing in the memory, values stored in those objects, inbound
Help us improve. Please let us know the company, where you were asked this question :
Ans. Java has a intrinsic way of checking leaks and reclaiming memory called garbage collection. Moreover Java doesn't support pointer arithmetics , so there is very low comparative chance of memory leaks, compared to C,C++
Though there may be tools that may audit code to make sure that we are not leaving much for the garbage collection to work but I have never heard anyone doing anything for memory leaks in Java.
Help us improve. Please let us know the company, where you were asked this question :