I have a file in which there are 3 lines, I read it and put it into a string builder, and then the builder installs a view for the show, as if everything is standard.

The question is, what will happen if the file is 3 lines and 100 pages, how correct is it to read the data in such a volume in the builder and is there enough memory for it?

  • and asinktak enough - Android Android
  • @AndroidAndroid I assume that the problem may be that the string builder itself will turn out to be very large ... or is it possible? It’s just that it didn’t happen that now the file is small and everything works, then there will be a heavy file and everything will fall ... - Aleksey Timoshchenko
  • If you look at the sources of StringBuilder, it will be clear that it stores char [] in itself. Accordingly, I think the answer to the question about memory is obvious - Andrew Bystrov
  • @AndrewBystrov Probably I have not had time to understand the essence of programming, but it is not obvious to me)) What does this mean? - Aleksey Timoshchenko
  • The array has a variable length - the number of elements. This variable is of type int => the maximum number of elements in the array is 2147483647. The size of the char is 2 bytes. => 2 * 2147483647 ~ 4 GB. Of course, I could be wrong - Andrew Bystrov

0