java - Memory issues with substring -
How does the substring method work internally and how can it make a memory problem?
How can we solve it?
Before Java 7 udate 6, substring on the original string View is used to return. Imagine that you had a string of 1,000,000 characters and it is called s.sstring (0, 1) because you are only interested in the first letter, the original string will be in memory.
Because Java 7u6 substring returns a new string that prevents the issue.
Comments
Post a Comment