How substring() method of string class create memory leaks?
Answer / Rahul G. Momin
The substring() method in Java does not create memory leaks by itself. However, if the original String object is modified after a substring is created from it, then both the original and the substring will reference the same underlying character array. When one of them goes out of scope (due to garbage collection), the other might still hold a reference to it, causing a memory leak. To avoid this issue, create new String objects for each substring.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the diff types of exception?
What is the difference between a stub and a skeleton?
9 Answers ABC, College School Exams Tests, Geoservices, Polaris, Qualcomm, Rajiv Gandhi College of Engineering and Technology RGCET, UTIITSL, Wipro,
What are the purpose of introspection?
How to implement dphibernate to activate lazy loading in Flex with java ?thanx in advance!
Difference between DurableSubscription and non- DurableSubscription?
What is the difference between system.out ,system.err and system.in?
What is the RMI and Socket?
what is the Remote Stub?
if i know the lenght of collection in hand, should I use Array or Arraylist? justify
Explain the life cycle of servlet?
Explain the purposes of methods wait(), notify(), notifyAll ()?
What is ioc concept?